According to the example http://demos.telerik.com/kendo-ui/grid/editing-custom I implemented a dropdown editor in a Grid popup editor with Kendo Grid version 2014.3.1411.
Now, with version 2015.2.624 it does not set the dropdown list to the value the item already has. Wasted 2 hours to find out :-((
Does anyone have an idea why and for what reason we have this degradation of code with the new version? Thanks in advance!
Martin
Here is the code that works in the old version:
function
mt_measurandDropDownEditor(container, options) {
$(
'<input id=\"dde_mt_measurand\" name=\"MT_MEASURAND\" data-text-field=\"TY_LONGNAME\" data-value-field=\"TY_ID\" data-bind=\"value:'
+ options.field +
'\" />'
)
.appendTo(container)
.kendoDropDownList({dataTextField: \
"TY_LONGNAME\", dataValueField: \"TY_ID\"
, name:
'MT_MEASURAND'
, autoBind:
false
, optionLabel:
'--- bitte wählen ---'
,
dataSource: {
type: \
"odata\"
,
transport: {
read: {
url:
function
(data) {
return
odataServiceName +
'Codes'
;
},
dataType:
'json'
},
parameterMap:
function
(data, action) {
if
(action ===
'read'
) {
var
domainFilter = \
"TY_DOMAIN eq guid'1e68ffd6-aaaa-4558-94e1-23df53e5a6c6'\"
;
var
d = kendo.data.transports.odata.parameterMap(data);
if
(d.$filter) {
d.$filter = domainFilter + \
" and \"
+ d.$filter ;
}
else
{
d.$filter = domainFilter;
}
return
d;
}
else
{
return
data;
}
}
},
schema: {
data:
function
(data) {
return
data;
},
total:
function
(data) {
return
data.length;
},
model: {
id: \
"TY_ID\"
,
fields: {
TY_ID: { type:
'string'
},
TY_NAME: { type:
'string'
},
TY_LONGNAME: { type:
'string'
}
}
}
},
change:
function
(data) {
kendo.bind($(
'#dde_mt_measurand'
), data.items);
$(
'#dde_mt_measurand'
).attr(
'dataloaded'
,
'true'
);
}
}
})
};