Ambasador
Ambasador

Reputation: 377

Problems in displaying the values of combobox in the grid

I'm trying to print the value of combobox in Ext.grid.Panel (Extjs 6).

I do this:

....

{
        xtype: 'gridcolumn',
        text: 'Контрагент',
        dataIndex: 'contragent',
        editor: {
                xtype: 'combobox',
                store: Ext.data.StoreManager.lookup('ContrAgents'),
                displayField: 'name',
                valueField: 'id'
            },
            renderer: function(val){
            myStore = Ext.data.StoreManager.lookup('ContrAgents');

                index = myStore.findExact('contragent',val);
                console.log(index);
                if (index != -1){
                    rs = myStore.getAt(index).data;
                    return rs.display;
                }
            }
},

....

index for each record is always with the value -1, but in each record the value of this combobox is set.

I noticed that when I get the store:

myStore = Ext.data.StoreManager.lookup ('ContrAgents');
console.log(myStore);

In the console, I see:

constructor {removed: Array(0), isInitializing: false,....

Why can not the store be initialized?

Upvotes: 0

Views: 82

Answers (1)

samecat
samecat

Reputation: 343

In the "store:" field you can just type in the ID of the store and then when you are refering to a store with .lookup(), you have to be sure the store is loaded before.

this.getStore().load();

After that you can go on with your .findExact(parms..); Looks fine :)

Upvotes: 1

Related Questions