How to drop filters, sort column and paging in grid

9 posts, 0 answers
  1. Pavlik
    Pavlik avatar
    3 posts
    Member since:
    Jul 2012

    Posted 31 Oct 2012 Link to this post

    Hi!

    I want to clear, for example, the filter array in my grid:
    $('table#user_org_table').data('kendoGrid').dataSource.filter({});

    Filter is cleared, but after this .filter() function, my grid is automatically refreshed.
    How to clear filter, sorting and paging with 1 time grid refreshing?

    Thanks.
  2. Lee
    Lee avatar
    37 posts
    Member since:
    Oct 2012

    Posted 21 Nov 2012 Link to this post

    Ever figure this out? I'm interested, as well...
  3. Pavlik
    Pavlik avatar
    3 posts
    Member since:
    Jul 2012

    Posted 22 Nov 2012 Link to this post

    // Clear filter/sort/page
    $('table#user_org_table').data('kendoGrid').dataSource.query({
        page: 1,
        pageSize: 20,
        sort: {
            field: "SomeField",
            dir: "asc"
        },
        filter: [
            { field: "Search", value: "" },
            { field: "Status", value: "" }
        ]
    });
    So, use the ".query" method:)
  4. Raj
    Raj avatar
    34 posts
    Member since:
    Nov 2016

    Posted 12 May 2017 in reply to Pavlik Link to this post

    Hi Pavlik's

    Did you get this working? Its not working for me when i passed empty arrays to sort and filter to clear all at a time.

  5. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 17 May 2017 Link to this post

    Hello Raj,

    The filter and sort object could not contain an empty array, but if they are missing, the current expressions should be removed:
    $("#grid").getKendoGrid().dataSource.query({page:1, pageSize: 20})

    The above should clear all expression and should leave only the applied paging.


    Regards,
    Konstantin Dikov
    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.
  6. Raj
    Raj avatar
    34 posts
    Member since:
    Nov 2016

    Posted 17 May 2017 in reply to Konstantin Dikov Link to this post

    I tried your Code but thats not working as expected.

    It is throwing error with empty sort and filter in the URL. please find attached Image.

    Below is my code.

    //clear grouping, sorting, filtering
                var datasource = $('#FacilityGrid').data('kendoGrid').dataSource;
               datasource.sort([])
               datasource.filter([])
               datasource.group([])

    This works as expected but it is making three calls to controller. I want to clear all at a time.

    With your Query    $("#FacilityGrid").getKendoGrid().dataSource.query({ page: 1 }); it is throwing error.
               

  7. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    2062 posts

    Posted 22 May 2017 Link to this post

    Hello Raj,

    Please try to send the pageSize in the query method in order to work as expected. 

    Regards,
    Boyan Dimitrov
    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.
  8. Raj
    Raj avatar
    34 posts
    Member since:
    Nov 2016

    Posted 22 May 2017 in reply to Boyan Dimitrov Link to this post

    Thanks for the fix. It works as expected.

    But The number of records on footer are showing as NaN after executing that query.

    please find attached image. How to fix that. I am using virtual scrolling.

    Thanks

    Raj.

  9. Konstantin Dikov
    Admin
    Konstantin Dikov avatar
    2466 posts

    Posted 25 May 2017 Link to this post

    Hello Raj,

    Could you please create a dojo example demonstrating the issue, so we could inspect it locally:
    Looking forward to your reply.


    Regards,
    Konstantin Dikov
    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