View Full Version : Filter with the list options dynamic

21 Jul 2014, 6:14 AM
I'd like to load the options list of filter dynamic.
I create 1 store 'optionsStore'
storeId: 'optionsStore' :

proxy: {
type: 'ajax',
url: '1.json',
reader: {
type: 'json'
fields: [
name: 'list',
type: 'string'
then the column to filter :

filter: {
type: 'list',
options: [],
store: 'optionsStore',
labelField: 'list',
phpMode: true

The options list to load is in the file '1.json', something like [{"list": "op1"},{"list": "op2"},...]

And it can load the options from file JSON correctly, but when I select the options, nothing send in the request. Ex : I select 'op1', but the request sent is [{"type":"list","value":"","field":"field_to_filter"}]

I add this line code in the optionsStore :

autoLoad: {
callback: function() {
var grid = Ext.getCmp("thegrid");
grid.getView().getHeaderCt().child('#field_to_filter').initialConfig.filter.options = optionsStore.collect('list');
And I get the error Cannot read property 'getView' of undefined
Someone can help please? thanks!

29 Jul 2014, 10:00 AM
The store shouldn't know about the grid, also you are providing options and store, you should really use just one.

The store is loading as soon as it's created but the grid is not created yet.