Question

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;
        }
    };
Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top