如何清除存储并更新分页工具栏?

发布于 2024-12-04 21:55:56 字数 617 浏览 2 评论 0原文

当我单击搜索按钮重新设置时,我需要将分页工具栏参数重置为 "page""start""limit"使用不同的参数加载网格存储!

我该怎么做?

问题是,当我在下一页上进行新搜索时,我有参数 page=2start=25limit= 25 dirty,相反我需要重置这个参数。

我的代码:

listeners: {
    click: function(){
        Ext.getCmp('GrlGio').getStore().removeAll();
        Ext.getCmp('GrlGio').store.load({
                params:{
                  mode: "RIC",
                  DataRicerca: dd,
                  Pit: Ext.getCmp('cmbPiattaforma').getValue()
                }
        });
    }
 }

谢谢!

i need to reset paging toolbar parameters as "page", "start", "limit" when i click on a search button to re-load grid store with different parametres!

how can i do it?

the problem is that when i am on the next page, and i do a new search, i have the parameters page=2, start=25, limit=25 dirty, instead i need to reset this parametres.

my code:

listeners: {
    click: function(){
        Ext.getCmp('GrlGio').getStore().removeAll();
        Ext.getCmp('GrlGio').store.load({
                params:{
                  mode: "RIC",
                  DataRicerca: dd,
                  Pit: Ext.getCmp('cmbPiattaforma').getValue()
                }
        });
    }
 }

thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(11

紫瑟鸿黎 2024-12-11 21:55:56

在 Ext 4 中,我发现 loadPage() 非常适合重置数据存储并使分页工具栏返回第一页。例子:

store.loadPage(1) // note: 1-based, not 0-based

In Ext 4, I found loadPage() worked pretty well for resetting the data store and making the paging toolbar go back to the first page. Example:

store.loadPage(1) // note: 1-based, not 0-based
土豪我们做朋友吧 2024-12-11 21:55:56

为我做了这个伎俩

伙计们 currentPage=1在每次调用下面的命令加载商店之前
顺便说一下,我得到了 500 个结果并加载到缓存中
分页适用于本地,您可以在任何新搜索之前尝试此任何方式

                        var store = Ext.getStore('MyStoreS');
                        store.proxy.extraParams = { employeeId : searchStr};

                        store.currentPage = 1;

                        store.load();

Guys currentPage=1 did the trick for me

before loading the store every time call the below
By the way i am getting 500 results and loading in cache
Pagination is for local, any way you can try this before any new search

                        var store = Ext.getStore('MyStoreS');
                        store.proxy.extraParams = { employeeId : searchStr};

                        store.currentPage = 1;

                        store.load();
-残月青衣踏尘吟 2024-12-11 21:55:56

您可以手动重置参数

Ext.getCmp('GrlGio').getStore().getProxy().pageParam =1;
Ext.getCmp('GrlGio').getStore().getProxy().startParam =0;

,然后进行存储加载。我知道它看起来是硬编码的,但这是我找到的唯一解决方案......

you can manualy reset the params

Ext.getCmp('GrlGio').getStore().getProxy().pageParam =1;
Ext.getCmp('GrlGio').getStore().getProxy().startParam =0;

and then do the store load. I know it looks hardcoded but it's the only solution i found...

花伊自在美 2024-12-11 21:55:56

试试这个 -

pagingToolbar.moveFirst();

Try this -

pagingToolbar.moveFirst();
心奴独伤 2024-12-11 21:55:56

通过覆盖 ext.data.store 定义以下函数“resetStartParam”:

Ext.override(Ext.data.Store, {

            resetStartParam:function(){

                //get the latest store options
                var storeOptions=this.lastOptions;

                if(storeOptions!=undefined){

                    //get the param names
                    var pn = this.paramNames;

                    //get the params from options
                    var params=storeOptions.params;

                    //change the param start value to zero
                    params[pn.start] = 0;

                    //reset options params with this new params
                    storeOptions.params=params;

                    //apply this new options to store options
                    this.storeOptions(storeOptions);
                    }
                }
    });

现在单击搜索按钮时调用此函数:

Ext.getCmp('GrlGio').getStore().resetStartParam(); 

就是这样。它应该可以工作。

Define following function "resetStartParam" , by overriding ext.data.store:

Ext.override(Ext.data.Store, {

            resetStartParam:function(){

                //get the latest store options
                var storeOptions=this.lastOptions;

                if(storeOptions!=undefined){

                    //get the param names
                    var pn = this.paramNames;

                    //get the params from options
                    var params=storeOptions.params;

                    //change the param start value to zero
                    params[pn.start] = 0;

                    //reset options params with this new params
                    storeOptions.params=params;

                    //apply this new options to store options
                    this.storeOptions(storeOptions);
                    }
                }
    });

Now call this function on click of your search button:

Ext.getCmp('GrlGio').getStore().resetStartParam(); 

Thats it.It should work.

憧憬巴黎街头的黎明 2024-12-11 21:55:56

我知道这是一篇旧文章,但我想我应该添加我的便士工作。我正在使用 EXTJS 4 并且遇到了类似的问题。当我进行新的搜索时,页码等没有重置。我找到的解决方案似乎可以自动与导航栏一起使用,它是使用商店的 currentPage 属性。我确实有一个稍微奇怪的设置,但是当我进行新搜索时执行 this.currentPage = 1 对我来说效果很好

I know that this is an old post but I thought I'd add in my pennies work. I'm using EXTJS 4 and had a similar problem. When I did a new search the page number etc did not reset. The solution I found, which appears to work with the nav bar automatically is using the currentPage attribute of the store. I do have a slight odd setup but doing this.currentPage = 1 when I do a new search works fine for me

爱本泡沫多脆弱 2024-12-11 21:55:56

之后在您的处理程序中尝试此操作

Ext.getCmp('gridpanel').getStore().removeAll();
Ext.getCmp('PagingToolbar').moveFirst();

,输入您的搜索查询并相应地加载商店

Ext.getCmp('gridpanel').getStore().load({params : { start : 0, limit : maxRecords, searchText : _searchText } });

希望它有帮助

try this in your handler

Ext.getCmp('gridpanel').getStore().removeAll();
Ext.getCmp('PagingToolbar').moveFirst();

after this, put your search query and load the store accordingly

Ext.getCmp('gridpanel').getStore().load({params : { start : 0, limit : maxRecords, searchText : _searchText } });

hope it helps

带上头具痛哭 2024-12-11 21:55:56

只需在removeAll()之后调用pagingToolbar.onLoad()即可。简单明了。

just call pagingToolbar.onLoad() after removeAll(). Plain and simple.

野却迷人 2024-12-11 21:55:56

下面是我如何通过分页实现搜索。它只执行 1 个请求并刷新分页数据。

onExecuteSearch: function(){
  var params = this.getSearchForm().getForm().getFieldValues()
      , proxy = this.getSomeGrid().getStore().getProxy();

  proxy.extraParams = params;
  this.getPagingToolbar().moveFirst();
}

getFieldValues() 文档: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.Basic-method-getFieldValues

有关代理“extraParams”的更多信息,请参见此处: ExtJs4 - 存储 baseParams 配置属性?

Here is how I achieved search with paging. It only does 1 request and it refreshes the paging data.

onExecuteSearch: function(){
  var params = this.getSearchForm().getForm().getFieldValues()
      , proxy = this.getSomeGrid().getStore().getProxy();

  proxy.extraParams = params;
  this.getPagingToolbar().moveFirst();
}

getFieldValues() documentation: http://docs.sencha.com/ext-js/4-0/#!/api/Ext.form.Basic-method-getFieldValues

For more about the proxy "extraParams" look here: ExtJs4 - Store baseParams config property?

只是在用心讲痛 2024-12-11 21:55:56

这工作正常(正确刷新分页信息):

    myStore.removeAll();

    myStore.fireEvent('load', myStore, [], {});

This work fine (refresh correctly the paging info):

    myStore.removeAll();

    myStore.fireEvent('load', myStore, [], {});
何以心动 2024-12-11 21:55:56

必须将页面大小更改为 500 才能打印整个商店/网格,打印后,将网格恢复到原始页面大小 25。

    // 500 records are now in the store and on the grid
    ux.core.grid.Printer.print(this.getOrderList());
    store.pageSize = this.displaySize;   // new page size is 25
    this.getPagingToolbar().doRefresh(); // equivalent of pressing a refresh button on the toolbar

解决办法 - 使用相同的排序器/过滤器/currentPage 重新加载商店

Had to change the page size to 500 for printing the WHOLE store/grid, and once printed, restore the grid to the original page size of 25.

    // 500 records are now in the store and on the grid
    ux.core.grid.Printer.print(this.getOrderList());
    store.pageSize = this.displaySize;   // new page size is 25
    this.getPagingToolbar().doRefresh(); // equivalent of pressing a refresh button on the toolbar

does the trick - reloads store with the same sorters/filters/currentPage

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文