Reputation: 11642
I need to trigger the change event if i change text in predefined cell.
I need something like this:
{ field: "username",
title : $translate.instant('USER_NAME'),
onchange:function(value) {
// HERE I NEED TO GET CHANGED TEXT
}
},
How can i do it in Kendo UI?
Thanks for help.
Upvotes: 0
Views: 9246
Reputation: 1978
Use the Datasource Parameter Map once you click update you can take the changed data and map it before its send to server
var dataSource = new kendo.data.DataSource({
transport: {
update: {
url: "Test url",
dataType: "json"
},
parameterMap: function(data, type) {
if (type == "update") {
// data.models will have your updated Values
return { models: kendo.stringify(data.models) };
}
}
}
});
Update
If you need to get the change event for cell attach a event handler to the cell if grid dataBound event
dataBound: function (e) {
// index is what ever the column index you need
$("#kgrid").find('table tr td:nth-child(index)').unbind("click").bind("click", function (e) {
var dataItem = $("#kgrid").data("kendoGrid").dataItem($(this).closest("tr"));
});
}
Upvotes: 0