I have a kendo grid which works fine but when I want to remove a row I don´t get the id of the record to pass it to code behind's method. When it reaches code behind says: "undefined" (refers to parameter varId). What's wrong??
var transpContactLeads = {
read: function(options) {
$.ajax({
type: "POST",
url: "xx.aspx/GetLeadsDate",
contentType: "application/json; charset=utf-8",
data: "{'varId': '" + options.id + "'}",
dataType: 'json',
success: function(msg) {
options.success(msg);
}
});
},
destroy: function(options) {
$.ajax({
type: "POST",
url: "xx.aspx/UpdateGrid",
contentType: "application/json; charset=utf-8",
data: "{ 'varId': '" + options.id + "' }",
dataType: 'json',
success: function(msg) {
options.success(msg);
}
});
},
parameterMap: function(options, type) {
if (type == "destroy") {
return {
varId: options.id
};
}
return options;
}
};
//DataSources
var dsContactLeads = new kendo.data.DataSource({
transport: transpContactLeads,
schema:
{
data: "d",
//total: "d.length",
model:
{
id: "id",
fields:
{
id: { type: "int" },
Name: { type: "string" },
Province: { type: "string" },
Investment: { type: "string" },
DateContact: { type: "string" }
}
}
},
pageSize: 10
});
//Grid
var gridContactLeads = $("#grid").kendoGrid({
dataSource: dsContactLeads,
columns:
[
{ command: ["destroy"], title: " ", width: "175px" },
{ field: "id", filterable: false},
{ field: "Name", title: "Name", width: 240},
{ field: "Province", width: 120, title: "Province" },
{ field: "Investment", width: 120, title: "Investment" },
{ field: "DateContact", width: 92, title: "Date" },
],
editable: "inline",
selectable: true
});