javascriptextjsroweditor

Extjs 5 rowediting only in some conditions


Good day all, I have a table in which I use the rowediting feature, and I have this column:

{
  text: 'CPL Object',
  dataIndex: 'CPLObj',
  flex: 1,
  editor: {
           allowBlank: false
   }

}

now, I'd like to make this column editable, only if another column has a certain value, let's say if the 'model' column has 'CPU' as value. Otherwise I'd like to Not have the editor for this value.

Is that possible?


Solution

  • do you mean your using grid? Have you tried adding a formula on your viewModel for checking if the model column you wish to check do have a value? Maybe something like:

    Viewmodel:
       checkvalue: function(get){
         var x = true;
         if (get('current.model' !== ''){ 
            x = false 
         } 
         return x;
        }
    
    
       ViewController: (on your binding)
       column: {
         readonly: '{checkvalue}' 
       }