ExtJs. Set cell value with rowediting value

I have a grid with the RowEditing plugin. The editor has 2 columns: one with combobox and the other with the text field disabled.

I need to change the value of a text field after changing the value of the combo box.

I have a combobox listener:

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

But the value in the text box is not updated to another roweditor call.

I just need to set the text value for the cell without updating the repository. And also, if I click the roweditor cancel button, I need to return the cell value to the old one.

Thanks for your time, all the answers and all the help.

+4
source share
1 answer

You can change it using the grid selection model, 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'
           }
  }

. , edit ,

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

, DEMO

+5

Source: https://habr.com/ru/post/1545867/


All Articles