4
votes

I have grid with RowEditing plugin. Editor has 2 columns: one with combobox and another with disabled textfield.

I need to change textfield value after changing the combobox value.

I have combobox listener:

listeners = {
       select: function (combo, records) {
            var editorRecord = myGrid.getPlugin('rowEditPlugin').editor.getRecord();
            editorRecord.data["SomeCol"] = "SomeValue";
       }
}

But value in the textfield does not refresh until another calling of roweditor.

I need just to set text value to the cell, without updating store. And also if I click cancel button of roweditor, I need cell value returning to old one.

Thanks for your time, all replies and all help.

1

1 Answers

5
votes

You can change it using the selection model of the grid,something like this :

   {
     text: 'Type',
     dataIndex: 'type',
     editor: {
         xtype: 'combo',
         typeAhead: true,
         selectOnTab: true,
         displayField:"name",
         listeners: {
               select: function(combo, records) {
                   myGrid= this.up('grid');
                   var selectedModel = this.up('grid').getSelectionModel().getSelection()[0];
                   //selectedModel.set('dataIndexOfNextCol', "Success");
                   val = combo.getValue();
                    if(val == 'type1'){
                         Ext.getCmp('textFld').setValue("success");
                     }
                     else{
                         Ext.getCmp('textFld').setValue("failure");
                     }
           }
  },
  {
    text: 'Item',
    dataIndex: 'item',
    editor: {
               xtype: 'textfield',
               id: 'textFld'
           }
  }

You have to commit the changes on update.So you can call edit event listener,

listeners: {
    edit: function(editor, e) {
        e.record.commit();
    }
},

For reference , have a look at this DEMO