Question is regarding optionsText binding to get fullName.
When I do this it works as in Knockout doc,
<select multiple="multiple" width="50" data-bind="options: leftItems,optionsText: function(item) {return item.firstName() + ' ' + item.lastName() }, selectedOptions:leftSelectedItems"></select>
But when I move the function to View Model and try to use it does not work,
Here is my select,
<select multiple="multiple" width="50" data-bind="options: leftItems,optionsText: returnFullName(item), selectedOptions:leftSelectedItems"></select>
In my View Model,
self.returnFullName = function(item) {
console.log("self.returnFullName called.");
console.log(item);
return item.firstName() + ' ' + item.lastName();
};
Error I am getting is that "Uncaught ReferenceError: Unable to process binding "options: function (){return leftItems }" which is even not related to optionText.
Am I missing something?