KendoUI:单击按钮后将网格数据重置为第一页 [英] KendoUI: resetting grid data to first page after button click

查看:56
本文介绍了KendoUI:单击按钮后将网格数据重置为第一页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下情况:

在我的页面中,我有一个绑定到数据源的网格(带有分页).当我单击按钮提取"时,将填充网格(通过Web服务读取分页数据). 然后,我通过网格分页选择第2页".再次调用Web服务以返回数据.

in my page I have a grid (with pagination) bounded to a datasource. When I click on the button "Extract" the grid gets populated (reading paginated data through a web service). Then i select "page 2" through grid pagination. Again the web service is invoked to return data.

现在:我想再次单击提取",以在第一页上重新加载并显示数据.我不确定哪种方法最好.

Now: I would like to click on "Extract" once more, to reload and show data on the first page. I'm not sure which is the best way.

我只想对服务进行一次调用(使用输入参数),并重置网格中的分页索引.

I would like to make just one call to the service (with input parameters) and have pagination index in the grid resetted.

我现在正在使用以下代码:

I am now using the following code:

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

但是它实际上对该服务进行了两次调用.

but it actually makes two calls to the service.

推荐答案

如果要进行服务器端分页,则应该做grid.dataSource.page(1)就足够了,因为这将完全像您已经意识到的那样调用read.

If you are doing server side paging it should be enough doing grid.dataSource.page(1) since this will invoke the read exactly as you already realized.

这篇关于KendoUI:单击按钮后将网格数据重置为第一页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆