Hello Guys,
I have some problems with Kendo Grid Column Update:
1) I have grid which is this:
grid.kendoGrid({
dataSource: dataSource,
toolbar: [
{ text: "Save Changes", className: "update_sportsgid", imageClass: "k-update" }
],
columns: ["id",name", { field: "enabled", title: "Status", editor: statusEditor },],
editable: true
}
});
2) Column named "enabled" in that grid has custom editor with ComboBox and function for that editor is this:
function statusEditor(container, options) {
var selOptions = '<option value="Enabled">Enabled</option><option value="Disabled">Disabled</option>';
var input = $("<select name="+options.field+">"+selOptions+"</select>");
input.appendTo(container);
input.kendoComboBox();
}
3) In the grid i have toolbar which has class "update_sportsgid" and i attach click event on that toolbar button:
$('.update_sportsgid').click(function (e) {
e.preventDefault();
me.updateSportsGrid(grid);
});
4) When toolbar button is click i call update function:
updateSportsGrid: function (grid) {
//Get Whole Displayed Data
var displayedData = grid.data().kendoGrid.dataSource._data;
var dataToSend = [];
//Iterate over grid and get changed row values
for(var i = 0;i<displayedData.length;i++) {
var current = displayedData[i];
if(current.dirty) {
var node = {
id:current['id'],
type:"Sport",
priority:current['priority'],
enabled:current['enabled'],
topBets:current['topBets']
}
dataToSend.push(node);
}
}
The problem is that when i change column with custom editor "ComboBox" column doesn't change and row doesn't have dirty value true.
How can i bind custom editor to change data of grid view?
I have some problems with Kendo Grid Column Update:
1) I have grid which is this:
grid.kendoGrid({
dataSource: dataSource,
toolbar: [
{ text: "Save Changes", className: "update_sportsgid", imageClass: "k-update" }
],
columns: ["id",name", { field: "enabled", title: "Status", editor: statusEditor },],
editable: true
}
});
2) Column named "enabled" in that grid has custom editor with ComboBox and function for that editor is this:
function statusEditor(container, options) {
var selOptions = '<option value="Enabled">Enabled</option><option value="Disabled">Disabled</option>';
var input = $("<select name="+options.field+">"+selOptions+"</select>");
input.appendTo(container);
input.kendoComboBox();
}
3) In the grid i have toolbar which has class "update_sportsgid" and i attach click event on that toolbar button:
$('.update_sportsgid').click(function (e) {
e.preventDefault();
me.updateSportsGrid(grid);
});
4) When toolbar button is click i call update function:
updateSportsGrid: function (grid) {
//Get Whole Displayed Data
var displayedData = grid.data().kendoGrid.dataSource._data;
var dataToSend = [];
//Iterate over grid and get changed row values
for(var i = 0;i<displayedData.length;i++) {
var current = displayedData[i];
if(current.dirty) {
var node = {
id:current['id'],
type:"Sport",
priority:current['priority'],
enabled:current['enabled'],
topBets:current['topBets']
}
dataToSend.push(node);
}
}
The problem is that when i change column with custom editor "ComboBox" column doesn't change and row doesn't have dirty value true.
How can i bind custom editor to change data of grid view?