PDA

View Full Version : SuperBoxSelect Issue



dhiren.lodhia
4 Mar 2010, 5:28 AM
i have following plugin which i have inserted in to PanelGrid,on click of which i am opening a FormPanel for editing a record which contains one superbox with user roles as display field & role_id as value field.
when form opens i need to set username[textbox] & existing roles of a user[superbox].
the problem is as follows :
[1] when form is shown first time textbox is populated but superbox is not populated.
[2] when i do
Ext.getCmp('roles-superbox').setValue('1,5'); //1&5 is role id

for superbox to set role ids,the same ids are not removed from store so as a result
superbox contains 1,5 role id[pre populated] as well as 1,5 role id in list also.
so when i remove it duplicates in the superbox.


var UpdateUserColumn = function(){
var grid;
function getRecord(t){
var index = grid.getView().findRowIndex(t);
return grid.store.getAt(index);
}
function onClick(e, t){
roleSuperComboStore.load();
addUserFormWin.show(); //addUserFormWin is my formpanel
Ext.getCmp('roles-superbox').setValue('1');
}
Ext.apply(this, {
width: 26,
header: '<div class="update-col-hd"></div>',
menuDisabled:true,
fixed: true,
id: 'task-col',
renderer: function(){
return '<div class="update-col"></div>';
},
init : function(xg){
grid = xg;
grid.on('render', function(){
var view = grid.getView();
view.mainBody.on('click', onClick, this, {delegate: '.update-col'});
});
}
});
};
superbox code in form panel is :


{
id:'roles-superbox',
fieldLabel: 'User\'s Roles ',
xtype:'superboxselect',
resizable: true,
name: 'role_ids',
anchor:'99%',
store: roleSuperComboStore,
mode: 'local',
displayField: 'combovalue',
displayFieldTpl: '{combovalue}',
valueField: 'comboid',
// queryDelay: 0,
triggerAction: 'all',
allowBlank:false
}