3

If I have a declared select

<select id="sel1" dojoType="dijit.form.Select" >...

And I add my knockout data binding

<select id="sel1" dojoType="dijit.form.Select" data-bind=".....">...

If the knockout array/bind is initialised prior to the dojo.ready they the select box is populated with the correct values, however because dojo re-writes the templates we lose our observables.

I'd rather not migrate to dojo observables but this seems like I'd have to in this case.

I am continuing to investigate but it looks like we'll need to make this move.

JTew
  • 3,149
  • 3
  • 31
  • 39

2 Answers2

1

I'm not a big fan of the approach by knockout-dojo-connector. I think a cleaner approach would be to keep your KO bindings in your markup and apply an attr binding for your dojo type. Something like this should work: <select id="sel1" data-bind="attr: {'dojoType': dojoTypeInViewModel}">...

innopal
  • 58
  • 5
1

Edit: This is not the answer, although it is a starting point.


It looks like there is knockout dojo connector.

https://github.com/imankulov/knockout-dojo-connector/blob/master/sample.html


But no samples for observablearrays and binding with selects.

JTew
  • 3,149
  • 3
  • 31
  • 39