extjs bbar过滤器不按需要工作? [英] extjs bbar filter not working as desired?

查看:120
本文介绍了extjs bbar过滤器不按需要工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是正确的语法,用于向gridpanel的底部工具栏动态添加过滤器?

  this.Grid.getBottomToolbar ).plugins = [过滤]; 

当我这样做时,没有错误。但它没有履行承诺。即当过滤器被点火时,寻呼不会重置为1。
SoI加载页面,转到第2页,然后更改过滤器,只有1条记录(比如说)。它显示:第2页,共1页,因为分页未重置。



我的语法是否正确? >

文档说:


分页:如果指定为
的插件当您更新过滤器时,网格配置的PagingToolbar,
当前页面将重置为页面
1。



解决方案

这不是正确的方式没有...你应该在创建底部工具栏的实例时附加你的过滤器,你可以在它已经被创建之后添加到他的插件数组现在网格登录插件行为太迟了。

  var filterPlugin = new Ext.ux.grid.FilterPlugin (); 

var myGrid = new Ext.grid.GridPanel({
store:store
,columns:columns
,sm:new Ext.grid.RowSelectionModel({singleSelect :true})
,bbar:new Ext.PagingToolbar({
pageSize:this.perPage
,store:store
,plugins:[filterPlugin]
})
});


Is this the correct syntax for dynamically adding a filter to a bottom toolbar of gridpanel?

this.Grid.getBottomToolbar().plugins=[filters];

There are no errors when I do this. But it does not behave as promised. i.e. the paging does not reset to 1 when the filter is fired. SoI load the page, go to page 2, then change the filter and there is only 1 record(say). It shows: page 2 of 1 because the paging is not reset.

Is my syntax correct?

The docs say:

Paging : If specified as a plugin to the grid's configured PagingToolbar, the current page will be reset to page 1 whenever you update the filter.

解决方案

this is not the correct way no ... you should attach your filters when creating your instance of the bottom toolbar, you are adding it to he plugins array probably after it has already been created and that's too late for the grid to register the plugin behaviour on itself.

var filterPlugin = new Ext.ux.grid.FilterPlugin();

var myGrid = new Ext.grid.GridPanel({
     store : store
    ,columns : columns
    ,sm : new Ext.grid.RowSelectionModel({singleSelect:true})
    ,bbar : new Ext.PagingToolbar({
         pageSize : this.perPage
        ,store : store
        ,plugins: [ filterPlugin ]
    })
});

这篇关于extjs bbar过滤器不按需要工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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