PDA

View Full Version : Data Grid Local Filter with the values of a Data Store



pathum
16 Mar 2011, 4:30 AM
I have a data store and i need my data grid to be filtered according to the values in that store.
Here's my code for the store.


var store = new Ext.data.Store({
baseParams: {ajax_command: 'loadStore'},
proxy: new Ext.data.HttpProxy({
url: '/store/load.ajax'
}),
reader: new Ext.data.JsonReader({
root: 'store_filter',
id: 'did'
},[
{name: 'did', mapping: 'did'},
{name: 'title', mapping: 'type'}
])
});


Then I am binding this in my GridFilter.


var searchListFilters = new Ext.ux.grid.GridFilters({
local: true,
filters:[
{type: 'list', dataIndex: 'standard_event', store: store, labelField: 'title'},
...
...
...
...
]});


Then comes my Grid Panel.


grid = new Ext.grid.GridPanel({
xtype: 'grid',
autoScroll:true,
autoWidth: true,
overflow:'auto',
height: 200,
draggable: false,
plugins: [searchListFilters],
title:'Test Grid',
store:store,
enableColumnResize : true,
cm: new Ext.grid.ColumnModel([
{
header: 'Standard Event',
id: 'standard_event',
dataIndex: 'standard_event',
width:80,
align: 'left',
sortable: true,
filterable: true,
filter: {type: 'string'}
},
...,
...,
...,
...
]),
bbar: new Ext.PagingToolbar({
store: store,
pageSize: 50,
plugins: [searchListFilters]
})
});


What my problem is, the filter item list is visible in my grid's header. But once I select one item from it, none of the records will display in the grid.

Any suggestions? or any workaround?

steffenk
16 Mar 2011, 5:12 AM
you included the plugin in PagingToolbar but should be in grid.

pathum
16 Mar 2011, 5:23 AM
I am afraid, its already in the grid panel as well.