Hi,
if I use a template to customize a kendo grid data entry, I can pass a key as a parameter to a js function. In this way I can customize the behaviour of the function depending on other keys in the model field (=table row).
Just a nonsense example to show what I mean:
Let's say we have the data
[{ id: 1, name:
"foo"
}]
and the model
{ id:
"id"
, fields: {
"foo"
: {type:
"String"
},
"id"
: {type:
"Number"
}}
then I can write into the "foo" column template key
kendoGrid({ columns: [{field:
"foo"
, template:
"#=getID(id)#"
}] })
which references to the js function
function
getID(id) {
return
"<b>"
+id+
"</b>"
}
I'm a bit suprised that this works (has somebody an explanation why the template can access the id key of the data)? I'm quite new to js...), but it does and is quite helpful for me.
Now to the topic: I'd like to to customize the editor - a dropdownlist like in the example http://demos.telerik.com/kendo-ui/grid/editing-custom. But the content of this dropdownlist should change according to the data. Is there a way to pass the value of a key to the editor function in a similar way like in the template example above?
function
dropDownListEditor(container,
options
,id) {
[...]
kendoDropDownList({dataSource: {data: dropdowncontent[id]}}))
[...]
}
As I have understood the editor function has the predefined parameters container+options, are these fixed or somehow extendable? Which is the best way to implement such a behaviour?
Thanks in advance!