RadGrid paging after the grid is filtered

4 posts, 0 answers
  1. Josip
    Josip avatar
    2 posts
    Member since:
    Dec 2019

    Posted 03 Dec 2019 Link to this post

    Hello,

    I have a question regarding paging in RadGrid when the grid is already filtered.

    I am using NeedDataSource event for binding the grid.

    My datasource query is rather slow so I implemented custom paging and it is working fast as expected when paging the RadGrid when no filter is active.

    But when I filter the RadGrid, the paging is very slow. Changing the page number lasts like when the grid is fetching the data when filtering.

    I understand that the process of filtering cannot be faster because of my datasource query, but is there a way that I can make paging faster when my grid is filtered?

    Thank You for your help.

     

  2. Eyup
    Admin
    Eyup avatar
    3892 posts

    Posted 06 Dec 2019 Link to this post

    Hi Josip,

     

    Here are some suggestions for this case:

    1. Check the dedicated Custom Paging live sample and see how the filtering is handled:
    https://demos.telerik.com/aspnet-ajax/grid/examples/functionality/paging/custom-paging/defaultcs.aspx

    The custom paging works just with partial data that's why it is fast. Actions like Filtering, Sorting and Grouping on the other hand require the entire database that's why this cannot be modified.

    2. Try Virtualization:
    https://demos.telerik.com/aspnet-ajax/grid/examples/performance/virtualization/defaultcs.aspx

    You can also check:
    https://www.telerik.com/support/kb/aspnet-ajax/grid/details/virtualization-and-custom-paging

    3. And if you have templates, you can implement the performance improvements mentioned here:
    https://www.telerik.com/forums/radgrid-becomes-too-slow-when-binding-over-100-records

    4. And the last solution would be to query the Database only once, then keep it in the Session, similar to this:
    https://demos.telerik.com/aspnet-ajax/treelist/examples/databinding/loadondemand/defaultcs.aspx

    Namely, this part:

            public DataTable TreeListSource
            {
                get
                {
                    if (Session["TreeListSource"] == null)
                    {
                        Session["TreeListSource"] = GetDataTable("SELECT TOP(10000) * FROM TestItems");
                    }
     
                    return Session["TreeListSource"] as DataTable;
                }
            }
    I hope this will prove helpful.

     

    Regards,
    Eyup
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
  3. Josip
    Josip avatar
    2 posts
    Member since:
    Dec 2019

    Posted 06 Dec 2019 in reply to Eyup Link to this post

    Hi Eyup,

    thank You for your answer.

    Option 4 is the one I thought of also, but I was trying to avoid that kind of approach, keeping all data in session or viewstate or even cookie.

    For now, when the grid is filterd, I am displaying all data on one page

    I will report here if I find some kind of a solution.

    Cheers,

  4. Eyup
    Admin
    Eyup avatar
    3892 posts

    Posted 11 Dec 2019 Link to this post

    Hi Josip,

     

    Thanks for sharing your approach.

    Feel free to turn to us if new questions arise.

     

    Regards,
    Eyup
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top