These are chat archives for ThoughtWorksInc/Binding.scala

Nov 2018
Mustafa Kuscu
Nov 29 2018 22:10

@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 watch/render/bind or something like this? In our case initialization after creation works well with and

@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
And here is the exception:

message is: "Cannot insert SELECT twice!"

Any ideas? I have traced through debugger and it enters only once into the JQuery call. And there is only one jquery instance, as seen by the inspector.
Mustafa Kuscu
Nov 29 2018 22:32
Oh.. i think the example happened to be a corner case. because the <select>...</select> was being transformed into a <div>...</div> by jquery on the fly. and perhaps this is confusing the internals of binding.dom.
Mustafa Kuscu
Nov 29 2018 22:38

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>

yay, it works ;)