extjs4 - How to set combo's options/ Store dynamically -
i using itscomponentcolumn in grid.
i want set different store every user.
if in grid there 4 user's , want set every user different combo store when user click on combo, see option's depending upon permission, or store set.
xtype: 'itscomponentcolumn', text : '<b>permission</b>', width: 150, dataindex: 'permission', items: function(value,record) { return { xtype: 'combobox', store: [[0,'view only'], [1,'view & edit'], [2,'view,edit & delete'],[3,'no access']], //store:combo_store, querymode:'local', displayfield: 'display', valuefield: 'value', name:'permission', forceselection:true, width: 145, listeners: { } i can not attached image. imagine there grid 5 records. grid has 2 columns, user name, permission in permission column showing combo , code gave above.
suppose there vivek user , if has view permission's want show view in combo next vivek record.
same other user's.
i have tried set store using bindstore, didn't work me.
please suggest me how ?
after suggestion code
xtype: 'itscomponentcolumn', text : '<b>permission</b>', width: 250, sortable:false, dataindex: 'permission', items: function(value,record) { return { xtype: 'combobox', store: new ext.data.store({ proxy: { type: 'ajax', url: combostoreurl+"¤etuserid="+record.get("userid"), reader: { type: 'json', root: 'jsonstore' } }, autoload: true }), but can know why give call server each time? mean every record.i guess there must other way because have permission in grid's store.
my actual grid code this.
var store = ext.create('ext.data.store', { storeid: 'sharecomponentstoreid', fields: ['userid','username','permission','isprojectowner'], proxy: { type: 'ajax', url:strurl, reader: { root: 'rootsharegrid', totalproperty: 'totalcount' }, writer: { type: 'json', writeallfields: false, allowsingle: false, encode: true, root: 'row' } } }); var sharegrid = 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: new ext.data.store({ proxy: { type: 'ajax', url: combostoreurl+"¤etuserid="+record.get("userid"), reader: { type: 'json', root: 'jsonstore' } }, autoload: true }), querymode : 'local', displayfield: 'display', valuefield: 'value', name:'permission', forceselection:true, width: 200, so record.get('permission') has users permission.
i want add permission combo store.
i.e. default combostore + user's permission.
hope able explain here.
please reply me possible on this
there several ways of doing of course. suggest have permissions store autoload:true. fetch user permissions right away , available combobox when grid loads.
Comments
Post a Comment