0

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

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

2 Comments

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 ?
@aurny2420289 Hanc marginis exiguitas non caperet.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.