`

Ext JS Library 2.0.2可编辑表格中怎么显示combo的Text

    博客分类:
  • Ext
阅读更多
做了个可编辑表格,但是表格中添加的combo显示的一直是value,而非text,很是郁闷,今天读Ext的源码,发现如下解决办法:

渲染器comboRenderer定义如下:
Ext.util.Format.comboRenderer = function(combo){
    return function(value){
        var record = combo.findRecord(combo.valueField, value);
        return record ? record.get(combo.displayField) : combo.valueNotFoundText;
    }
}

在可编辑表格列模式中添加上面的渲染器即可。

var combo = new Ext.form.ComboBox({
                 typeAhead: true,
                 triggerAction: 'all',
                 // transform the data already specified in html
                 transform: 'accTypeSel',
                 lazyRender: true,
                 listClass: 'x-combo-list-small'
             });



{ header: "accType",dataIndex:"accType", width: 100,
   editor:combo,
        renderer: Ext.util.Format.comboRenderer(combo)
   }
分享到:
评论
1 楼 liuweifeng 2010-12-14  
唉,看来Ext的协议让很多人不爽啊,没法用最新的版本……

相关推荐

Global site tag (gtag.js) - Google Analytics