Is it possible to get some or all of the values from subsequent pages in the grid?
For example:
The user is on page one or three. I would like to get all of the values for a particular column from the grid. Even those values not shown in the grid (pages 2 & 3).
4 Answers, 1 is accepted
Hello Greg,
This is possible only if the values are existing in the Grid's dataSource. For example if Ajax dataSource is used, the server operations should be disabled. This means that all of the items will be retrieved at once and could be accessed by the application.
E.g.
.DataSource(dataSource => dataSource
.Ajax()
.PageSize(20)
.ServerOperation(
false
)
)
Dimiter Madjarov
Telerik

Thanks for the reply.
Hmm, I'm not sure if that's an option for us. Some of our lists can grow quite large and the performance implications of trying to load all the data at once might be catastrophic.
Is there a way to request from the server additional pages without refreshing the UI? The example in the documentation for the "dataSource.query" does not appear to work and throws an exception around "slice".
Hello Greg,
I am not able to reproduce the mentioned bug in the query documentation page. Nevertheless using this method is not suitable for the current case, as the queried items will be bound to the Grid. There is no suitable workaround that we could suggest for the scenario.
Regards,Dimiter Madjarov
Telerik

I found a solution to my problem.The goal was to be able to get a complete list of all records that might be in the grid. A 'select all' without actually having all the items in the grid. What was key is to be able to apply all the same filters, sorts and groups to the data that are currently applied to the grid. Also it was very important that we maintain the current status of the grid. The example code below provides the functionality required.
var grid = $("#mygrid").data("kendoGrid");
var parameterMap = grid.dataSource.transport.parameterMap;
var data = parameterMap({ sort: grid.dataSource.sort(), filter: grid.dataSource.filter(), group: grid.dataSource.group() });
var extraParams = { sort: data.sort, filter: data.filter, group: data.group, varX: x, varY: y, varZ: z};
$.ajax({
url: _relativePath + "/MyController/MyMethod", //Same controller and method called by the grid definition.
data: extraParams,
type: "POST",
dataType: "json",
async: false,
success: function(result) {
alert('Success!');
},
error: function (e) {
}
});
Thanks.