如何告诉商店加载了什么页面 [英] How to tell store what page was loaded

查看:90
本文介绍了如何告诉商店加载了什么页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个绑定到网格的商店.加载时有n页.

I have a store that is binded to grid. When it is loaded it has n pages.

现在,我要显示包含某些值的页面.为此,我使用store.load({params: {'file': 'file33939'}});(使用文件"是因为网格显示文件列表,但这与问题无关).目前,我不知道它应该是什么页面.响应如下:

Now I want to show the page that contains certain value. In order to do that I use store.load({params: {'file': 'file33939'}}); (the 'file' is used because grid shows list of files, but it's irrelevant to question). At this moment I don't know what the page it should be. The response looks like:

{
  "files":[{"id":"33939", "name": "file33939"}, /* ... */],
  "total": 1000,
  "page": 13
}

网格显示正确的数据(该页面实际上包含"file33939").但是 pagingtoolbar 网格的行号 store.indexOfTotal()的行为就像加载了第一页一样(而不是第13页).

Grid displays correct data (the page that really contains 'file33939'). However pagingtoolbar, grid's rownumberer and store.indexOfTotal() behave as if the first page was loaded (instead of 13).

如何告诉"存储该存储刚加载的页面是13?

How can I "tell" store that the page that store just had loaded is 13?

推荐答案

要更改已加载的页面,请勿使用store.load().您应该找到一种获取给定数据的页码的方法(例如,通过ajax请求询问服务器),然后通过pagingtoolbar.move(pageNumber)更新该页.这将更新您的分页工具栏以及网格和商店,并且所有内容保持同步.

To change the loaded page you should not use store.load(). You should find a way to get the page number for the given data (e.g. asking the server via an ajax request) and then update the page via the pagingtoolbar.move(pageNumber). This will update your pagingtoolbar along with the grid and the store and everything remains in sync.

这篇关于如何告诉商店加载了什么页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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