PDA

View Full Version : How to set combo's options/ Store dynamically



AtulDawkhare
6 Jun 2012, 3:09 AM
I
am using itscomponentcolumn in my Grid.I want to set different store for every user.If in a Grid there are 4 user's , I want to set for every user different combo store so that when user click on the Combo, he will see option's depending upon his permission, OR store that I will set.



var MyGrid = Ext.create('Ext.grid.Panel', {
id: 'ShareComponentGrId',
enableColumnMove:false,
store: store,
columns: [
{
text: '<b>Name</b>',
flex: 1,
sortable:false,
width: 100,
dataIndex: 'userName'
},
{
xtype: 'itscomponentcolumn',
text : '<b>Permission</b>',
width: 250,
sortable:false,
dataIndex: 'permission',
items: function(value,record) {
return {
xtype: 'combobox',
store: comboStore,
queryMode : 'local',
displayField: 'display',
valueField: 'value',
name:'permission',
forceSelection:true,
width: 200,
listeners: {
afterrender: function(combo) {
if(record.get('isProjectOwner') || (record.get('permission')=='View Only')){
combo.setReadOnly(true);
}
var rec=combo.findRecordByDisplay(record.get('permission'));
if(rec){
combo.setValue(rec.get('value'));
}
}

}
};
}
}



suppose there is vivek user , if he has "view only" permission's then i want to show view only in the combo just next to vivek record.
Same for other user's.
I have tried to set the store using bindStore, but didn't work for me.
Please suggest me how to do this ?

35998

mitchellsimoens
11 Jun 2012, 5:56 AM
You should be able to execute bindStore on the combobox passing in the new store.