Wednesday, June 03, 2009

Extjs AUTO complete of combo box

Here is and example to make a auto complement combo box in Ext JS. 3 important factors keep in mind here:
1. I am using jsonstore and set mode to local
2. jsonstore should set autoload to "true"
3. Set triggerAction to "all" in the combo box config

{ xtype:'combo', id: 'shoutoutsTags',
fieldLabel: 'Tag',
value: '',
mode: 'local',
width: 200,
store: new{
url: 'get_data.php',
fields: ['id', 'name'],
root: 'tags',
autoLoad: true
displayField: 'name',
valueField: 'id',
forceSelection: true,
triggerAction: 'all',

hiddenName: 'mytag' //dont put it the same name as name filed value

No comments: