uncoloured
2 Feb 2012, 6:27 AM
Hey guys!
I'm using a grid within my application, which is connected to a store and a model. The raw data of one specific column consists only of an ID - 1, 2, 3 etc. I'm using a renderer on this gridcolumn to fetch another string value based on this ID, from a separate store. So the column might display "Donald Duck" when the raw data in the store/model is actually 2.
All this works fine (with some help from here...). Now I'm trying to add a listfilter to this column. By inserting the possible values manually in code it all works fine, like this: (code from column definition)
filter: { type: 'list',
options: [
['1', 'Mickey Mouse'],
['2', 'Donald Duck'],
['3', 'Chuck Norris']
]
}
However, I'd really like these values and labels to be loaded dynamically from my second store "Characters". I've tried many variations of the following:
filter: { type: 'list',
dataIndex: 'character_id',
labelField: 'character_name',
store: Ext.data.StoreManager.lookup('Characters')
}
... but it seems no matter what I try it just won't work. I've tried with and without the dataIndex/labelFields.
So, in short - I have a main grid displaying MOVIES from the "main" store Movies. One of the columns display CHARACTER, but the grid filter won't load from the "second" store Characters.
Any and all help is very much appreciated!
I'm using a grid within my application, which is connected to a store and a model. The raw data of one specific column consists only of an ID - 1, 2, 3 etc. I'm using a renderer on this gridcolumn to fetch another string value based on this ID, from a separate store. So the column might display "Donald Duck" when the raw data in the store/model is actually 2.
All this works fine (with some help from here...). Now I'm trying to add a listfilter to this column. By inserting the possible values manually in code it all works fine, like this: (code from column definition)
filter: { type: 'list',
options: [
['1', 'Mickey Mouse'],
['2', 'Donald Duck'],
['3', 'Chuck Norris']
]
}
However, I'd really like these values and labels to be loaded dynamically from my second store "Characters". I've tried many variations of the following:
filter: { type: 'list',
dataIndex: 'character_id',
labelField: 'character_name',
store: Ext.data.StoreManager.lookup('Characters')
}
... but it seems no matter what I try it just won't work. I've tried with and without the dataIndex/labelFields.
So, in short - I have a main grid displaying MOVIES from the "main" store Movies. One of the columns display CHARACTER, but the grid filter won't load from the "second" store Characters.
Any and all help is very much appreciated!