is it possible to call a Jquery/Javascript function from an update section of a grid ?
i want to perform some actions before calling the controller method, My code looks like below. Please help me
dataSource: new kendo.data.DataSource({
transport: {
read: {
url: crudServiceBaseUrl + "/Products",
dataType: "jsonp"
},
update: {
url: crudServiceBaseUrl + "/Products/Update", // instead of URL i want to call a custom Javascript function here
dataType: "jsonp"
},
},
4 Answers, 1 is accepted

Hello Naga,
What you want to do is indeed possible, you just have to subscribe to the requestStart event during initialization and then check that the type of the request is actually update instead of read, create, or destroy. You code would look as such:
01.
dataSource:
new
kendo.data.DataSource({
02.
transport: {
03.
read: {
04.
url: crudServiceBaseUrl +
"/Products"
,
05.
dataType:
"jsonp"
06.
},
07.
update: {
08.
url: crudServiceBaseUrl +
"/Products/Update"
,
09.
dataType:
"jsonp"
10.
},
11.
},
12.
requestStart:
function
(e) {
13.
if
(e.type ==
"update"
) {
14.
//YOUR LOGIC GOES HERE
15.
}
16.
}
Hope this helps!

Hi
Thanks for the reply,
I am getting the below error
0x800a138f - JavaScript runtime error: Unable to get property 'data' of undefined or null reference
also if I click the Edit button and again click on cancel in the Edit popup , the record i have used is missing in the grid
Please help me
here is my code.
dataSource: {
type: "json",
transport: {
read: URL,
update: {
url: UpdateURL,
dataType: "json",
type: "POST"
},
parameterMap: function (data, operation) {
if (operation !== "read") {
return kendo.stringify(data);
}
}
},
requestStart: function(e) {
if (e.type == "update") {
//My LOGIC
debugger;
}
},
schema: {
type: "json",
id: "ID",
model: {
fields: {
ID: { type: "number", editable: false},
Name: { type: "string", validation: { required: true } },
Status: { type: "string" },
Access: { type: "string", nullable: true },
Address: { type: "string" },
Comment: { type: "string", validation: { required: true } },
ParentID: { type: "number", validation: { required: true } },
ParentName: { type: "string" },
}
}
},
serverPaging: false,
serverFiltering: false,
serverSorting: false
},
height: 550,
filterable: true,
sortable: true,
pageable: {
pageSize: 100,
refresh: true
},
columns: [
{ command: ["edit"], title: " ", width: "100px" },
{ field: "ID", title: "ID", width: "300px" },
{ field: "Name", title: "SubInventory", width: "300px" },
{ field: "Status", title: "Active", width: "75px" },
{ field: "Access", title: "Access", width: "200px" },
{ field: "Address" },
{ field: "Comment", tite: "Comments", width: "250px" },
{ field: "ParentID", title: "ParentName", width: "180px", editor: dropdownforParent}
]
, filterMenuInit: onFilterMenuInitSI,
editable: "popup",
}).data("kendoGrid");

Hi Naga,
It seems like Eo answered your original question. To inquire about a different subject, please create a new thread, so this one will be useful for future users who read the title description.
Thank you!

Thank You!!!
will do that