Why when I set a value, the selectedItem object is always null. Any solution?
$("#cboElement").dxLookup('instance').option('value', '111111111')
onValueChanged: (data){ data.selectedItem -> is null!!! }
$("#cboElement").dxLookup({
dataSource: new DevExpress.data.DataSource({
load: function (options) {
var d = new $.Deferred();
if (!($("#cboOther").val() > 0)) {
d.resolve([]);
} else {
util.Ajax("Provider.aspx/ListPaginate", JSON.stringify({
IdOther $("#cboOther").val(),
page: options.skip, length: options.take, search: options.searchValue
}),
function (result) {
var _data = result.d;
d.resolve(_data);
});
}
return d.promise();
},
byKey: function (key) {
var d = new $.Deferred();
util.Ajax("Provider.aspx/GetOne", JSON.stringify({ search: key }),
function (result) {
var _data = result.d;
d.resolve(_data);
});
return d.promise();
},
key: ["Id"],
paginate: true,
pageSize: 5
}),
displayExpr: "Description", valueExpr: "Id", searchEnabled: true, searchExpr: ["Description", "Id"],
itemTemplate: function (data) { return data.Id + ' - ' + data.Description; },
width: '100%',
onValueChanged: function (data) {
console.log(data, data.selectedItem);
if (data.selectedItem != null) {
//.. ?????
}
}
});