In the example on this demo page the JavaScript function is responsible for creating and populating the DropDownList in the Grid's cell that is being edited as follows:
Question: How does the data-bind attribute of the input element work and relate to the grid? In your example the value of options.field = 'Category'
I'm trying to understand how it relates to the code that defines the columns (specifically the template part for the category column):
I'm not sure how this is intended to work, or how the DropDownList and the Grid work together in this example.
Regards,
Jacques
function
categoryDropDownEditor(container, options) {
$(
'<input required data-text-field="CategoryName" data-value-field="CategoryID" data-bind="value:'
+ options.field +
'"/>'
)
.appendTo(container)
.kendoDropDownList({
autoBind:
false
,
dataSource: {
type:
"odata"
,
transport: {
}
}
});
}
I'm trying to understand how it relates to the code that defines the columns (specifically the template part for the category column):
columns: [
{ field:
"ProductName"
,title:
"Product Name"
},
{ field:
"Category"
, title:
"Category"
, width:
"160px"
, editor: categoryDropDownEditor, template:
"#=Category.CategoryName#"
},
{ field:
"UnitPrice"
, title:
"Unit Price"
, format:
"{0:c}"
, width:
"120px"
},
{ command:
"destroy"
, title:
" "
, width:
"90px"
}
]
Regards,
Jacques