0
votes

I have a grid with some store, assigned to it and with combobox as column editor (with another store for values). In order to display correct value in a grid I'm using custom renderer, and in this renderer I need access to combobox's store - and that's the problem.

I see two possible ways:

  1. somehow to put this store to grid from controller;
  2. get store from combobox.

Unfortunately, I couldn't find solution for none of them. Can you help me? Thank you in advance.

Current renderer code which currently doesn't solve my problem (need to be remade in order to get title from store)

    var comboRenderer = function(value, metaData, record, rowIndex, colIndex, store, view) {
        var combo = this.down('#typeCombo');
        if (combo) {
            var record = combo.findRecord('name', value);
            return record.get('title');
        } else {
            return value;
        }
    };

UPD: new renderer, working:

    var comboRenderer = function(value, metaData, record, rowIndex, colIndex, store, view) {
        var types_store = Ext.getStore('comboStore');
        var index = types_store.findExact('name', value.toString());
        if (index != -1) {
            return types_store.getAt(index).get('title');
        } else {
            return value;
        }
    };
1
Post some code, how do you have your relevant view/controller declared? - Evan Trimboli
Seems that the value to be displayed should be in the record to render the row, not in the store for the combobox. If you need the display property you should consider bring it in with the record and use it in the renderer. - dbrin
@EvanTrimboli there's a lot of code, what exactly do you want to see? Yes, I have separate view and controller. - uncle Lem
@dbrin I added renderer code - is this what you mean? If yes - it works fine while editing the grid, but it can't take value this way when I'm loading data from server when grid creates - combo is null. So I want to get it from store directly. - uncle Lem
is the combobox store the same across all rows ? You could potentially then just do a Ext.getStore(..). For b) does not combo.getstore work ? - sunny

1 Answers

1
votes

Please note that the recommended way of working with Extjs is using their MVC application architecture. However under the hoods the StoreManager is in play. You can try its alias Ext.getStore(...) to try and fetch the store.