Search code examples
extjscomboboxgridstore

How to set different store for different comboboxes in one column?


I have grid with to columns. In second column i have to comboboxes (for example at 1st row and 3rd). How to set different store for them? Values of second combobox depends on first combobox

here is an image

I saw one example but there was different columns, not rows


Solution

  • this has not been tested but will give you an idea. use the cellediting plugin "beforeedit" event handler to get combo1 value and load combo2.

    //beforeedit eventhandler for combo2. fired before cellEditing is triggered.

    beforeedit:function(editor_, e_){
      //get combo1 record, then get combo1 value
      var rec= this.grid.store.getAt(rowIndexForCombo1);
      var cbo1Val = rec.data.COMBO_1;
    
      var cbo2 = e_.column.field || e_.column.editor;
      //pass combo 1 value to combo2 proxy as extraParam, then load combo2.
      cbo2.store.proxy.extraParams = {COMBO1VAL:cbo1Val};
      cbo2.store.load();
    }