PDA

View Full Version : List Filter with value label



KostasP
31 Jul 2012, 8:06 AM
I have a grid column that gets values from 1-7 and a renderer that renders a text label according to the value. I want to add a filter using the filters feature that lets the user select one of possible labels and filter the column with the respective value. Any help on how is this done. I've been trying with listfilter but cant make it work that way...

scottmartin
31 Jul 2012, 12:02 PM
Have you seen the following example:
http://dev.sencha.com/deploy/ext-4.1.0-gpl/examples/grid-filtering/grid-filter-local.html

Scott.

KostasP
31 Jul 2012, 12:45 PM
var filters = { ftype: 'filters',
filterCls: 'filtcolumn',
autoReload: true,
encode: false,
menuFilterText: 'Φίλτρα',
local: true,
filters: [
{
type: 'string',
dataIndex: 'EvtDescription'
}, {
type: 'string',
dataIndex: 'EvtReportUsrName'
}, {
type: 'string',
dataIndex: 'EvtAssignUsrName'
},{
type: 'string',
dataIndex: 'EvtReparationUsrName'
},{
type: 'string',
dataIndex: 'EvtReparationComments'
},{
type: 'date',
dataIndex: 'EvtReportTime'
},{
type: 'date',
dataIndex: 'EvtReparationTime'
},{
type: 'date',
dataIndex: 'EvtAssignTime'
},{
type: 'list',
dataIndex: 'EvtCategoryTech',
store: {
fields: ['id', 'text'],
data: [
{id:'1', text:'01. ΗΛΕΚΤΡΟΛΟΓΙΚΑ'},
{id:'2', text:'02. ΥΔΡΑΥΛΙΚΑ'},
{id:'3', text:'03. ΕΛΑΙΟΧΡΩΜΑΤΙΣΜΟΙ'},
{id:'4', text:'04. ΓΥΨΟΣΑΝΙΔΕΣ'},
{id:'5', text:'05. ΞΥΛΟΥΡΓΙΚΑ'},
{id:'6', text:'06. ΑΛΟΥΜΙΝΙΑ'},
{id:'8', text:'07. ΨΥΚΤΙΚΑ'},
{id:'7', text:'ΧΧ. ΑΛΛΟ'}
]
}
},{
type: 'boolean',
dataIndex: 'EvtRelapse',
yesText: 'NAI',
noText: 'OXI'
},{
type: 'boolean',
dataIndex: 'EvtArchived',
defaultValue: false,
yesText: 'NAI',
noText: 'OXI'
},{
type: 'boolean',
dataIndex: 'EvtRepaired',
yesText: 'NAI',
noText: 'OXI'
}
]
};

that's my filter config. It gives me the following error:


Uncaught TypeError: Object #<Object> has no method 'on' ListMenu.js:79 (http://localhost/Maintenance/extjs/examples/ux/grid/menu/ListMenu.js?_dc=1343767405209)

KostasP
1 Aug 2012, 2:54 PM
Any ideas or suggestions?

scottmartin
1 Aug 2012, 6:10 PM
I would have to confirm this, but I am not sure your store call is correct..
should be options .. as shown in the example:


options: ['extra small', 'small', 'medium', 'large', 'extra large'],


Scott.

KostasP
2 Aug 2012, 10:51 AM
I want the user to be able to select among labels and the store to be filtered with the actual values. The actual value is an int 1to 7 and there is a renderer that displays the respective label. So what config should I use for the list filter to make it work that way? Store? Option? and with what syntax? I used the sytax from the example but there it appears as the vaue and the label are the same ["small", "small"], ["extra small", "extra small" ], etc...

scottmartin
2 Aug 2012, 2:03 PM
I would have to test this, but I would think that options array could be populated just like you have the data object in your store?

Scott.

KostasP
6 Aug 2012, 3:34 PM
Any news on the matter? did u check on this problem?