KendoUI: resetting grid data to first page after button click

后端 未结 5 1840
心在旅途
心在旅途 2020-12-18 21:29

I have the following scenario:

in my page I have a grid (with pagination) bounded to a datasource. When I click on the button \"Extract\" the grid gets populated (re

5条回答
  •  星月不相逢
    2020-12-18 21:59

    Use the DataSource.query() method to pass the page number and your custom input parameters:

    $("#btnExtract").bind("click", function(e) {
        var grid = $("#section-table").data("kendoGrid");
        grid.dataSource.query( { page: 1, parameter: "value"} );
    });
    

    If you're using server side paging and sorting then you may need to include that information as well:

    $("#btnExtract").bind("click", function(e) {
        var grid = $("#section-table").data("kendoGrid");
    
        var queryParams = {
            page: 1,
            pageSize: grid.dataSource.pageSize(),
            sort: grid.dataSource.sort(),
            group: grid.dataSource.group(),
            filter: grid.dataSource.filter(),
            parameter: "value"
        };
    
        grid.dataSource.query(queryParams);
    });
    

提交回复
热议问题