frank
frank

Reputation: 115

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

Upvotes: 1

Views: 468

Answers (2)

pengc_2012
pengc_2012

Reputation: 16

I think you can filter your store , when the combobox get fucus.

listeners : {

focus : function(...){

        store.clearFilter();
        store.filterBy(function(item){
            return .....;//true or false;
        });
}

}

Upvotes: -1

stackato
stackato

Reputation: 1145

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();
}

Upvotes: 2

Related Questions