i have a oj-select-one componenet with the following def :
<oj-select-one id="select1" style="max-width:20em"
options={{data3}}
value="{{data3.Id}}"
options-keys="{{optionKeys2}}" >
</oj-select-one>
and in the js file the optionkeys are
self.optionKeys2 = {value:"Id", label:"CourseName"};
i want to get the Id of the selected one and store that value in a var how to achieve that ?
You need to define a new observable for that.
<oj-select-one id="select1" style="max-width:20em"
options={{data3}}
value="{{selectedValue}}"
options-keys="{{optionKeys2}}" >
</oj-select-one>
JS
self.selectedValue = ko.observable();
self.optionKeys2 = {value:"Id", label:"CourseName"};