I am trying to create a simple contact editor application in Backbone.js and I have encountered a problem that I donβt know how to solve, because I am not familiar with Backbone.js yet.
I have a Model Contact , and this element has a ProductLineID field (each contact has a Product Line with which it is associated). When displaying an editor for this contact, I would like to display a drop-down list with possible ProductLine parameters and set it to the current value. How can I do this in Backbone.js?
I know how to do this in knockout.js with data binding:
<select id="ProductLineID" name="ProductLineID" data-bind="options: productLineOptions, optionsValue: 'ID', optionsText: 'Name', value: ProductLineID, optionsCaption: 'All'"> </select>
In this example, productLineOptions is a JSON object that is already preloaded on the page.
This will do exactly what I want, but I donβt know how to make the equivalent in Backbone.js.
I can provide more code from my actual example, but it looks like this is a slightly trivial example and does not require specific code.
samandmoore
source share