Michael710
22 Apr 2012, 1:16 PM
Hi,
I have a grid and I would like to reset the datastore for column that contains a combo box. (I have a master detail form and this is the child grid. When rewriting the child data on selection of new master record I would also like to repopulate the combo box in the child grid. I don't want to repaint the whole grid if possible.)
My gird column code in column 4 of the grid is:
{ header:'FieldName', dataIndex:'FieldName', width: 100, editor:
{ xtype: 'combobox',
typeAhead: true,
selectOnTab: true,
triggerAction: 'all',
fields:['id','value'],
store: fieldStore,
valueField:'id',
displayField:'value',
multiSelect: false,
lazyRender: false,
listClass: 'x-combo-list-small'},
renderer: function(val) { var CodesStore = Ext.create('Ext.data.Store', { fields: [ {name: 'id'}, {name: 'value'} ], data: bssFieldNameData }); var matching = CodesStore.queryBy( function(rec){ return rec.data.id == val; }); return (matching.items[0]) ? matching.items[0].data.value : ''} },
my fieldStore is:
bssFieldNameData = [ { id:1, value: 'AGLOBAL'},{ id:2, value: 'AUSER'}];
fieldStore = Ext.create('Ext.data.Store', {
fields: [{name: 'id'}, {name: 'value'} ],
data: bssFieldNameData
}
);
I have tried to do:
bssNewFieldNameData = [{ id:1, value: 'BGLOBAL'},{ id:2, value: 'BUSER'}];
fieldStore.loadData(bssNewFieldNameData,false);
and have had some limited results but it does not work the way it should. Is there a better process for doing this?
Thanks,
Mike.
I have a grid and I would like to reset the datastore for column that contains a combo box. (I have a master detail form and this is the child grid. When rewriting the child data on selection of new master record I would also like to repopulate the combo box in the child grid. I don't want to repaint the whole grid if possible.)
My gird column code in column 4 of the grid is:
{ header:'FieldName', dataIndex:'FieldName', width: 100, editor:
{ xtype: 'combobox',
typeAhead: true,
selectOnTab: true,
triggerAction: 'all',
fields:['id','value'],
store: fieldStore,
valueField:'id',
displayField:'value',
multiSelect: false,
lazyRender: false,
listClass: 'x-combo-list-small'},
renderer: function(val) { var CodesStore = Ext.create('Ext.data.Store', { fields: [ {name: 'id'}, {name: 'value'} ], data: bssFieldNameData }); var matching = CodesStore.queryBy( function(rec){ return rec.data.id == val; }); return (matching.items[0]) ? matching.items[0].data.value : ''} },
my fieldStore is:
bssFieldNameData = [ { id:1, value: 'AGLOBAL'},{ id:2, value: 'AUSER'}];
fieldStore = Ext.create('Ext.data.Store', {
fields: [{name: 'id'}, {name: 'value'} ],
data: bssFieldNameData
}
);
I have tried to do:
bssNewFieldNameData = [{ id:1, value: 'BGLOBAL'},{ id:2, value: 'BUSER'}];
fieldStore.loadData(bssNewFieldNameData,false);
and have had some limited results but it does not work the way it should. Is there a better process for doing this?
Thanks,
Mike.