Hi,
i’m having a problem with knockout and a displayField.
The error is at the setcellvalue when it does the following: if(E!=null&&E.label!=null){r[h.displayfield](E.label);
The displayField is not a real property in my object, so r[h.displayfield] is undefined. Here’s a piece of my source code:
var ViewModelType = function (items) {
var self = this;
ko.mapping.fromJS(items, {child: {
create: function(options) {
return new ViewModelType(options.data);
}
}}, self);
};
var Model = {…};
var ViewModel = new ViewModelType(Model);
var StartupType = new $.jqx.dataAdapter({datatype: ‘json’, mapChar: ‘.’, async: false, id:’value’, datafields:[{name: ‘value’, type:’number’}, {name: ‘label’, type: ‘string’}], localdata: [{“value”:1,”label”:”AUTOMATIC”},{“value”:0,”label”:”MANUAL”}]},
var source = { type: ‘POST’,
datatype: ‘observablearray’,
mapChar: ‘.’,
datafields: [{name:’StartupTypedisp’, value: ‘StartupType’, values: { source: StartupType.records, value:’value’, name:’label’}},],
…
};
// initialize jqxGrid
$(‘#b2efb558-1135-4691-904a-f6e207a4d90f’).jqxGrid({
…
columns: [{text: ‘StartupType’, displayfield:’StartupTypedisp’, columntype: ‘dropdownlist’, initeditor: function (row, value, editor) {
editor.jqxDropDownList({ source: StartupType, displayMember: ‘label’, valueMember: ‘value’ });
}, datafield:’StartupType’ }]
Can i observe the real value behind the dropdown value? How can i get through this problem?
Thanks a lot