Pass Additional Parameters to Custom DataSource
Environment
Product | Progress® Kendo UI® Grid for jQuery |
Telerik UI for ASP.NET MVC | 2017.3.1026 |
Description
I have a hierarchical Grid with a custom DataSource and a ClientHandlerDescriptor
which is defined as described here.
How can I pass additional parameters to the ClientHandlerDescriptor
?
Solution
-
If you are using the
ClientHandlerDescriptor
for reading the data, define the JavaScript handler..Transport(new { read = new Kendo.Mvc.ClientHandlerDescriptor() { HandlerName = "function(options) {customRead(options, '#=ID#')}" }, })
-
The
customRead
JavaScript handler will accept the defaultoptions
argument as well as theID
of the parent Grid.function customRead(options, id) { $.ajax({ method: "POST", url: '@Url.Action("ActionName", "ControllerName")', dataType: "json", data: { ID: id, // more data here }, success: function(data) { options.success(data); } }); }