Kendo grid select all rows

4 posts, 0 answers
  1. Noël Thoelen
    Noël Thoelen avatar
    10 posts
    Member since:
    May 2004

    Posted 27 Feb 2017 Link to this post

    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!

  2. Tsvetina
    Admin
    Tsvetina avatar
    2481 posts

    Posted 01 Mar 2017 Link to this post

    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.
  3. Noël Thoelen
    Noël Thoelen avatar
    10 posts
    Member since:
    May 2004

    Posted 01 Mar 2017 in reply to Tsvetina Link to this post

    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

  4. Tsvetina
    Admin
    Tsvetina avatar
    2481 posts

    Posted 02 Mar 2017 Link to this post

    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.
Back to Top