This is a migrated thread and some comments may be shown as answers.

Kendo grid select all rows

3 Answers 706 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Noël Thoelen
Top achievements
Rank 1
Noël Thoelen asked on 27 Feb 2017, 09:17 AM

Hello,

I have created a kendo grid using the asp.net mvc wrappers and I want to add a selection capability. I am interested in selecting all the rows when a filter is made or not, without going through each page. More or less, I want to know if it is possible to make the selection on the server-side not on the client. I have looked through this example:http://dojo.telerik.com/@Stephen/EMeZE and it is not applicable in my case because I need to open each page and select all the rows. Is an other alternative?

Thank you very much!

3 Answers, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 01 Mar 2017, 07:27 AM
Hi Noël,

The Kendo UI widgets are client-side components and they do not have a server counterpart that you can work with. When you see a paged Grid, only the current page actually exists. The Grid refreshes on each change of page to clear the old rows and generate the new ones. This being said, there is no way to implement actual server selection of selection of all items on all pages.

However, you can implement functionality that looks like all-page selection. You can always select all Grid rows in the dataBound event. This will ensure that the user will see all rows selected after every data operation. Then, if you need to access the data items of the selected rows with paging ignored, you can use the suggestion from this forum thread: Get filtered data from paged grid.

Regards,
Tsvetina
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Noël Thoelen
Top achievements
Rank 1
answered on 01 Mar 2017, 09:23 AM

Hi Tsvetina,

please allow me to rephrase my question :

What I really want to accomplish is add a custom button below the grid, and once this is clicked, post the current grid filtering to the server in some way, so I can apply this filtering to an IQueryable and retrieve all the records which apply to this filter on the server.

I don't need to see the selection in the grid.

Can this be done?

kind regards

0
Tsvetina
Telerik team
answered on 02 Mar 2017, 03:10 PM
Hello Noël,

In such case, it seems like implementing custom binding for your Grid would be best. In this way, you will be able to apply the Grid filtering on the server and, if needed, store the filter queries for further use.

If this does not fit your requirements, you can continue using a Grid with client-side filtering and get its currently applies filter expression using the DataSource filter method.
function btnClick(){
    var gridFilterExpression = $("#myGrid").data("kendoGrid").dataSource.filter();
}

You can then build a query string from the filter expression and and pass it to an action method in your Controller.

Regards,
Tsvetina
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Noël Thoelen
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Noël Thoelen
Top achievements
Rank 1
Share this question
or