推迟列值的渲染

时间:2014-04-26 08:23:46

标签: extjs extjs4

我想在网格的列中显示另一个商店的值,但是在显示网格之后可以加载商店,因为它的大小。我想要这样的东西:

renderer: function(value, metaData, record, rowIndex, colIndex, gridStore, view) {
    var store = Ext.getStore('someBigStore');
    if (store.getCount() > 0) {
         return store.getById(value).get('name'); // If store is already loaded show value immediately
    } else {
        store.on('load', function(){
            var displayValue = store.getById(value).get('name');
            // -> how to insert the displayValue into the right place of the grid ?
        });
        return 'loading...' // show waiting message
    }
}

我如何存档?

1 个答案:

答案 0 :(得分:0)

好吧,我明白了,框架中没有任何功能可以做到这一点,但是有一点DOM浏览:

store.on('load', function () {
    var row = Ext.fly(view.getNode(rowIndex));
    var cell = row.down('td:nth-child(' + (colIndex + 1) + ') .x-grid-cell-inner');
    cell.setHTML(getDisplayValue());
}, null, { single: true });