I'm trying to get a custom editor (DropDownList) to work, but am not having any luck. I have the following setup:
Grid:
DataSource: a remote GET request that works fine
In the grid's datasource, I have a field called ProjectId that is set to editable and of type "number"
The grid displays all of the data just fine. When I click on a cell to switch it into edit mode, I'm showing a drop down that remotely gets a list of projects to display, based on the value of the ClientId field for that row. The code is below:
I'm only showing the editor if the ClientId field is not null. The drop down list displays fine, but after making my selection and clicking away, the underlying data does not get updated. I'm really not sure what I'm doing wrong here.
Grid:
DataSource: a remote GET request that works fine
In the grid's datasource, I have a field called ProjectId that is set to editable and of type "number"
The grid displays all of the data just fine. When I click on a cell to switch it into edit mode, I'm showing a drop down that remotely gets a list of projects to display, based on the value of the ClientId field for that row. The code is below:
var
projectsDataSource =
new
kendo.data.DataSource({
transport: {
read: {
url:
"/ProjectsDataUrl"
;
dataType:
"json"
}
}
})
function
projectsEditor(container, options) {
if
(options.model.ClientId !==
null
) {
projectsDataSource.transport.options.read.data = {
clientId: options.model.ClientId
};
projectsDataSource.read();
return
($(
"<input name='ProjectId' data-bind='value:"
+ options.field +
"' />"
)).appendTo(container).kendoDropDownList({
dataSource: projectsDataSource,
autoBind:
false
,
dataTextField:
"Name"
,
dataValueField:
"Id"
,
optionLabel:
"Select Project"
}).data(
"kendoDropDownList"
);
}
};
I'm only showing the editor if the ClientId field is not null. The drop down list displays fine, but after making my selection and clicking away, the underlying data does not get updated. I'm really not sure what I'm doing wrong here.