These are chat archives for ThoughtWorksInc/Binding.scala
General questions should be asked on StackOverflow, not here. This room focuses on development of Binding.scala.
@mcku "i have tried what you have suggested some time ago, and did not work" Are you sure what problem was in initialization and not in missing
bindor something like this? In our case initialization after creation works well with https://getmdl.io/ and https://materializecss.com
@glmars I think my conclusion is wrong and jQuery can access the element. And your proposal is very elegant and valuable.
However, it's not done yet.
dom.scala thinks it is inserting the element twice and throws an exception. But by tracing, i can confirm that the method is entered just once.
The element is here https://gist.github.com/glmars/a597f7c28931a38e2e9b3262279889a9#file-dropdown-initialize-scala-L17
And here is the exception: https://github.com/ThoughtWorksInc/Binding.scala/blob/v11.3.0/dom/src/main/scala/com/thoughtworks/binding/dom.scala#L106
message is: "Cannot insert SELECT twice!"
<select>...</select>was being transformed into a
<div>...</div>by jquery on the fly. and perhaps this is confusing the internals of binding.dom.
and it is successful if the element is not initially specified as a
select and dynamically contructed, instead if specified as something already html div like this (which is as legit as the previous one)
val simple = <div class="ui selection dropdown"> <input type="hidden" name="gender"/> <i class="dropdown icon"></i> <div class="default text">Gender</div> <div class="menu"> <div class="item" data-value="1">Male</div> <div class="item" data-value="0">Female</div> </div> </div>
yay, it works ;)