0

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;
        }
    };
4

1 回答 1

1

请注意,使用 Extjs 的推荐方式是使用他们的 MVC 应用程序架构。然而,在后台,StoreManager正在发挥作用。您可以尝试其别名Ext.getStore(...)来尝试获取商店。

于 2013-11-15T04:27:50.223 回答