In a grid column editable (ExtJs v4.2.2), how to change the store dynamically ? The point is to load store with different params by type of movement(movementTypeId):
the field with diffrent list to be attached is 'Reason', columns are:
this.columns = [
{
text: 'id',
dataIndex: 'movementId',
sortable: false,
hideable: true,
sortableColumn: false,
hidden: true,
flex : 1,
scope:this
},
{
text: 'TypeId',
dataIndex: 'movementTypeId',
sortable: false,
sortableColumn: false,
hideable: true,
sortableColumns: false,
hidden: true,
flex : 2,
scope:this
},
{
text: 'Reason',
dataIndex: 'movementReasonId',
sortable: false,
hideable: true,
sortableColumn: false,
field: {
xtype: 'combobox',
align: 'center',
typeAhead: true,
triggerAction: 'all',
//selectOnTab: true,
store: this.storeMovementReasonType,
displayField: 'label'
},
flex : 3,
scope:this
},
];
So for every row, when store is on load wanted to set extra param like:
if(movementTypeId === 89){
storeMovementReasonType.getProxy().setExtraParam('dictionaryTypeId',11);
}
if(movementTypeId === 94){
storeMovementReasonType.getProxy().setExtraParam('dictionaryTypeId',8);
}
is it possible ? Thanks for your time :)
asked Jul 1, 2016 at 13:28
aurny2420289
4715 silver badges16 bronze badges
1 Answer 1
You want to implement the beforeedit listener on your rowediting plugin:
listeners:{
beforeedit:function(editor , context , eOpts) {
var movementTypeId = context.record.get("movementTypeId");
if(movementTypeId === 89){
storeMovementReasonType.getProxy().setExtraParam('dictionaryTypeId',11);
}
if(movementTypeId === 94){
storeMovementReasonType.getProxy().setExtraParam('dictionaryTypeId',8);
}
storeMovementReasonType.load();
}
}
answered Jul 1, 2016 at 13:55
Alexander
20.3k21 gold badges86 silver badges172 bronze badges
Sign up to request clarification or add additional context in comments.
2 Comments
aurny2420289
I have to display the field Value of the store on the grid too. I'm using renderer, and wait for the store loaded before returning label, but the renderer method does't wait for the return.. do you have an idea ?
Alexander
@aurny2420289 Hanc marginis exiguitas non caperet.
default