PDA

View Full Version : GridFilters using a Store



jimtyp
2 Sep 2009, 8:47 AM
I am using GridFilters and it works great. However, to use a list of items to Filter on I need to use "options". If I use "store", which is an ArrayStore I get a proxy error message.

The following works, but what I would like is to replace "options" with "store"

var filters = new Ext.ux.grid.GridFilters({
local: true,
filters: [{
type: 'string',
dataIndex: 'name'
},{
type: 'string',
dataIndex: 'login'
},{
type: 'list',
dataIndex: 'site',
options: ["Columbia", "Pharr", "Monterrey", "Huntington", "Boise"]
}]
});

jimtyp
2 Sep 2009, 9:15 AM
Did some more research and found a link using a store with a filter BUT the items from my store show up blank in the filter list.

var siteStore = new Ext.data.ArrayStore({
autoDestroy: true,
idIndex: 0,
fields:[ 'option' ]
});


var filters = new Ext.ux.grid.GridFilters({
local: true,
loadOnShow: true,

filters: [{
type: 'string',
dataIndex: 'name'
},{
type: 'string',
dataIndex: 'login'
},{
type: 'list',
dataIndex: 'vendor',
recordFilter: 'option',
store: siteStore
}]
});

lpastor
2 Sep 2009, 10:51 AM
Hello,

I use that to filter :


filters = new Ext.ux.grid.GridFilters({
local:true,//specify true if you want to filter client side
filters:[
{dataIndex: 'id_projet', type: 'numeric'},
{dataIndex: 'name_projet', type: 'string'},
{dataIndex: 'datetime_projet', type: 'date'}
]
});//end filters setupand the plugin declaration :


var grid = new Ext.grid.GridPanel({
loadMask: true,
border: false,
store: store,
plugins: [filters],
columns : userColumnsGrid,
...
...You must have that in the html (with your path) :


<script type="text/javascript" src="ux/menu/EditableItem.js"></script>
<script type="text/javascript" src="ux/menu/RangeMenu.js"></script>
<script type="text/javascript" src="ux/grid/GridFilters.js"></script>
<script type="text/javascript" src="ux/grid/filter/Filter.js"></script>
<script type="text/javascript" src="ux/grid/filter/StringFilter.js"></script>
<script type="text/javascript" src="ux/grid/filter/DateFilter.js"></script>
<script type="text/javascript" src="ux/grid/filter/ListFilter.js"></script>
<script type="text/javascript" src="ux/grid/filter/NumericFilter.js"></script>
<script type="text/javascript" src="ux/grid/filter/BooleanFilter.js"></script>

jimtyp
2 Sep 2009, 11:14 AM
Thanks lpastor. My issue is not getting the filter to work. It does work. My issue is with the 'list' type filter, which you are not using.

My list filter, which is associated with a store, shows the correct number of entries 15, but they show up as all blank.

lpastor
2 Sep 2009, 11:33 AM
Sorry, I have the same problem with the list, I am new with ExtJS and maybe someone will find us a solution...

jimtyp
2 Sep 2009, 11:58 AM
Ah, got it!

I was missing the 'labelField' in the fitler. By the way, I'm using the 3.0 GridFilters v.0.28 with patch. The one in this thread: http://www.yui-ext.com/forum/showthread.php?t=14503



var siteStore = new Ext.data.ArrayStore({
autoDestroy: true,
fields:[ 'option' ]
});

filters = new Ext.ux.grid.GridFilters({
local: true,
filters: [{
type: 'string',
dataIndex: 'name'
},{
type: 'string',
dataIndex: 'login'
},{
type: 'list',
dataIndex: 'vendor',
store: siteStore,
labelField: 'option'
}]
});

lpastor
2 Sep 2009, 12:36 PM
Thanks jimtyp, that work fine...