I´m trying to renderer a string in my column instead of your id. I founded this solution: Grid cell is rendering wrong, but it´s don´t work with a dynamic store.
In my grid I put a store to load into the renderer:
columns: [
{xtype : 'gridcolumn', text: 'Id', dataIndex: 'id'},
{xtype : 'gridcolumn', text: 'Validade', dataIndex: 'dataValidade', renderer: function(object){return Ext.Date.format(object, 'd-m-Y');}},
{xtype : 'gridcolumn', text: 'Complexo', dataIndex: 'id', renderer: function(value) {
storeComplexoPorValidade.getProxy().url = caminhoContexto + "validade/complexoporid/" + value + "/dados.json";
storeComplexoPorValidade.load();
console.log(storeComplexoPorValidade);
var idx = storeComplexoPorValidade.find('id', value);
var rec = storeComplexoPorValidade.getAt(idx);
return rec.get('descricao');
}
},
But the store don´t load the data to var, although perform the request. And I catch the error: Cannot call method ‘get’ of undefined.
What´s wrong?
Thanks for your help, I have a lot work to make my script work. And with your tips I founded two others solutions that help me to put my code working. How to wait until all stores are loaded in ExtJs? and http://www.sencha.com/forum/showthread.php?197265-Loading-stores-synchronously
It´s my code working:
});
});
Thanks a lot!