Extjs3.2分页和过滤问题

时间:2014-05-19 12:44:09

标签: extjs extjs3

我正在研究extjs3.2。在我的网格中我应用了fileter和PagingToolbarResizer插件。我的问题是假设我有20个页面,每个页面包含10个记录(总记录= 200)。现在假设我在第6页并为某些列应用了过滤器。我有5条记录显示在第1页,但我当前的视图仍然在第6页。我想要的过滤后视图到第一页。 以下是我的过滤器代码

     var filters = new Ext.ux.grid.GridFilters({
// encode and local configuration options defined previously for easier reuse
 encode: true, // json encode the filter query
local: false,   // defaults to false (remote filtering)
autoReload : true,
filters: [   
{type :'string',  dataIndex: 'name'},
{type: 'string',  dataIndex: 'age'},
],

});

我的网格看起来像这样

var grid = new Ext.grid.GridPanel({
                    store : store,
                    id : "site_grid",
                    columns : [
                            {
                                header : "Name",
                                width : 120,
                                sortable : true,
                                dataIndex : 'name',
                                renderer: function (value, metaData, record, rowIndex, colIndex, store) {

                                     return  getToolTip(value, metaData, record, rowIndex, colIndex, store);
                                    } ,
                            },

                            {
                                header : "Age",
                                width : 400,
                                sortable : true,
                                dataIndex : 'age',
                                renderer: function (value, metaData, record, rowIndex, colIndex, store) {

                                     return  getToolTip(value, metaData, record, rowIndex, colIndex, store);
                                    } ,
                                editor : {
                                    xtype : 'textfield',
                                    allowBlank : true
                                }
                            } ],
                    viewConfig : {
                        forcefit : true,
                    },
                    plugins : [filters,editor],
                    title : 'Title',
                    height : 500,
                    width : 929,
                    frame : false,
                    tbar : new Ext.Toolbar(),
                     bbar: new Ext.PagingToolbar({
                            pageSize: 10,
                            store: store,
                            plugins : [filters],
                            displayInfo: true,
                            displayMsg: 'Displaying topics {0} - {1} of {2}',
                            emptyMsg: "No topics to display",
                            items:[  {
                                 cls: '.icon-user-clear',
                                 text: 'Clear Filter Data',
                                 handler: function () {
                                    grid.filters.clearFilters();
                                }
                            }],
                            plugins : [new Ext.ux.plugin.PagingToolbarResizer( {options : [10, 15, 25, 50 ], appendCombo: true})]
                        })
                    });

store.load({params:{start:0, limit:10}});

由于

1 个答案:

答案 0 :(得分:2)

你能否像这样改变你的插件

  plugins : [new Ext.ux.plugin.PagingToolbarResizer( {options : [10, 15, 25, 50 ], appendCombo: true}),filters]

基本上我只是在插件中添加过滤器

有关详细信息,请在此处查看

http://stackoverflow.com/questions/5030697/extjs-bbar-filter-not-working-as-desired]

由于