choose selected option with knockout.js -


i have combobox looks this:

<selectdata-bind="options: adaptposs, optionstext: 'description', click: function(data,event) {$parent.taskchanged(data,event)}">     </select> 

now want track element chosen (to speak in c# "selectedindexchanged") how function called in knockout?

you should use value binding:

<select data-bind="options: adaptposs, optionstext: 'description', value: selectedindexchanged, click: function(data,event) {$parent.taskchanged(data,event)}">     </select> 

read documentation @ knockout site: http://knockoutjs.com/documentation/options-binding.html

also don't need have such complex click handler, knockout automatically sends data , event objects function write following code:

<select data-bind="options: adaptposs, optionstext: 'description', value: selectedindexchanged, click: $parent.taskchanged"> </select> 

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -