I'm using the Kendo extensions for MVC and binding the grid like so:
I need a way to get the Ajax.Read.Data function name, in this case "searchUsuariosParams" from the kendo grid javascript object.
Thanks
@(Html.Kendo().Grid<
AS.Model.Usuario
>()
.Name("gridUsuarios")
.DataSource(dataSource => dataSource // Configure the grid data source
.Ajax() // Specify that ajax binding is used
.Read(read => read.Action("_Items", "Usuarios").Data("searchUsuariosParams")) // Set the action method which will return the data in JSON format and the function that will pass parameters
)
.Columns(columns =>
{
columns.Bound(it => it.Username).Title("Usuario");
columns.Bound(it => it.Displayname).Title("Nombre");
columns.Bound(it => it.Email).Title("Email");
columns.Bound(it => it.ID).Title("").Sortable(false).ClientTemplate("#= editUsuario(data) #");
})
.Pageable() // Enable paging an localize it
.Sortable() // Enable sorting
)
I need a way to get the Ajax.Read.Data function name, in this case "searchUsuariosParams" from the kendo grid javascript object.
Thanks
6 Answers, 1 is accepted
0
Hello,
Atanas Korchev
Telerik
We are not sure what you need. Could you please clarify what you mean by "get the Ajax.Read.Data function name"? Please elaborate.
Regards,Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Sergi
Top achievements
Rank 1
answered on 23 May 2013, 08:29 AM
Sorry about my english, I hope this is clearer.
I'm using the grid with ajax binding and a function called "searchUsuariosParams" that returns additional parameters for the ajax binding call.
I need a way to know from javascript the name of the function that returns the additional parameters for the ajax call, in this case I need to know that the additional parameters function is called "searchUsuariosParams".
Obviously I already know the name of the function but I'm doing unobstrusive generic methods that need to figure out the name of that function and call it.
Thanks in advance.
I'm using the grid with ajax binding and a function called "searchUsuariosParams" that returns additional parameters for the ajax binding call.
I need a way to know from javascript the name of the function that returns the additional parameters for the ajax call, in this case I need to know that the additional parameters function is called "searchUsuariosParams".
Obviously I already know the name of the function but I'm doing unobstrusive generic methods that need to figure out the name of that function and call it.
Thanks in advance.
0
Hi,
Atanas Korchev
Telerik
The following code should return that function:
$("#gridUsuarios").data("kendoGrid").options.dataSource.transport.read.data
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Sergi
Top achievements
Rank 1
answered on 23 May 2013, 10:51 AM
Thanks, that kind of works but it returns the whole function, in this case it's returning:
How can I call the function gridUsuariosParams with $("#gridUsuarios").data("kendoGrid").options.dataSource.transport.read.data?
Is there a way that it can only return "gridUsuariosParams" instead of the whole function code block?
Thanks again.
function
gridUsuariosParams() {
return
$(
"#form_search"
).serializeObject();
}
Is there a way that it can only return "gridUsuariosParams" instead of the whole function code block?
Thanks again.
0
Accepted
Hi,
Atanas Korchev
Telerik
We are not sure what you are going to do with the "gridUsuariosParams" as a string.
You can of course call that function:
var func = $("#gridUsuarios").data("kendoGrid").options.dataSource.transport.read.data;
func();
Atanas Korchev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0

Sergi
Top achievements
Rank 1
answered on 23 May 2013, 11:04 AM
Thanks a lot !
I didn't know you could instantiate a function like that and call it.
I didn't know you could instantiate a function like that and call it.