javascript - ExtJS 4.0.7 ItemSelector change "titles" dynamically -
i use itemselector element of extjs 4.0.7. default "titles" of itemselector are: "available" , "selected". can change dynamically?
looking @ source code here: http://docs.sencha.com/extjs/4.2.2/source/itemselector.html#ext-ux-form-itemselector-method-setupitems seems there 2 configs can used tell item selector titles use lists: fromtitle , totitle.
so imagine if set itemselector custom fromtitle (the title of 'available' list on left) , totitle (the title of 'selected' list on right) properties achieve want. haven't tried myself though...
update
sorry, above work on ext 4.2.2. had @ ext 4.0.7 , appears need use different configs. config need use called 'multiselects', can set titles. see example below:
{ xtype: 'itemselector', name: 'itemselector', id: 'itemselector-field', anchor: '100%', fieldlabel: 'itemselector', imagepath: '../ux/images/', store: mystore, displayfield: 'text', valuefield: 'value', value: ['3', '4', '6'], allowblank: false, msgtarget: 'side', multiselects: [{listtitle: 'first title'},{listtitle: 'second title'}] }
update 2
in order dynamically set titles, need configure panels ids using multiselects property:
{ xtype: 'itemselector', name: 'itemselector', id: 'itemselector-field', anchor: '100%', fieldlabel: 'itemselector', imagepath: '../ux/images/', store: ds, displayfield: 'text', valuefield: 'value', value: ['3', '4', '6'], allowblank: false, msgtarget: 'side', multiselects: [{listtitle: 'first title', id: 'itemselector-from-panel'},{listtitle: 'second title', id: 'itemselector-to-panel'}] }
this allow reference them later. created button dynamically set titles below:
ext.create('ext.button.button',{ text: 'change titles', renderto: ext.getbody(), handler: function(){ var fromfield = ext.getcmp('itemselector-from-panel'), tofield = ext.getcmp('itemselector-to-panel'); fromfield.panel.settitle('my new title'); tofield.panel.settitle('my newer title'); } });
Comments
Post a Comment