sherpal/LaminarSAPUI5Bindings

Cannot use Select component with "onChange" property in Scala 2.13

Closed this issue · 4 comments

I couldn't do this :

_.events.onChange.map(_.detail.selectedOption.dataset.get("name").get)

inside a Select component. This is how events.onChange was implemented :

 val onChange = new EventProp[dom.Event & HasDetail[HasSelectedOption]]("change")

then the type of onChange in Scala 2 is infered as Nothing, there's no more access to .detail.selectedOption
Is that a bug ? Is there any workaround for this ?
Thank you

Ouch, that's bad. I though that Scala 2.13 was able to understand & 😭

I'll correct that. In the meantime, you can always do

_.events.onChange.map(_.asInstanceOf[dom.Event with HasDetail[HasSelectedOption]]).map(_.detail.selectedOption.dataset.get("name").get)

It's not ideal, of course, but it will at least work.

I will change all the & back to with for now then...

Thank you so much !

It should be redeployed as 1.9.3 now, @khanhdb
(Only available for Laminar 15.x, hopefully that is what you use, otherwise it's a good incentive to upgrade 🤗 )

That's awesome. Big thank to you @sherpal