如何根据记录的值在editorgrid的组合框中过滤存储?

时间:2015-05-20 13:31:25

标签: extjs combobox grid extjs3

我有一个网格,其中有一个用于组合框的列。我需要根据以下记录过滤掉组合框的值:

 id  |   name    |      options
======================================
1    |  string   |  combobox(1,2,3)
2    |  string   |  combobox(1,2,3,4,5)
3    |  string   |  combobox(1,2,3)
1    |  string   |  combobox(1,2,3)

所以最终我需要基于id列的选项值。以下是我的extjs网格列配置。

columns: [{
                header: 'id',
                dataIndex: 'id',
                id: 'id',
                hidden: true
            },{
                header: 'Name',
                dataIndex: 'name',
                id: 'name',
                menuDisabled: true,
                flex : 1 
            },{
                header: 'options',
                dataIndex: 'options',
                id: 'options',
                menuDisabled: true,
                flex : 1,
                editor : {
                    xtype : 'combo',
                    store: optionStore,
                    valueField: 'id',
                    displayField: 'name',
                    triggerAction: 'all',
                    mode : 'local',
                    disabled: true,
                    listners: {
                        expand: this.filterFunc(this)
                    }
               },
               renderer: this.columnRenderer
            }]

如何在ExtJS editorgrid中针对不同的行过滤商店。

P.S - 我正在使用extjs 3.4版本

2 个答案:

答案 0 :(得分:1)

你可以使用渲染器,它应该是这样的:

renderer: function( value, metaData, record, rowIndex, colIndex, store ) {
    value.store.filter( [
        {
            property: 'filteredProperty',
            value: record.get('id')
        }
    ] );
}

答案 1 :(得分:1)

我在下面的列配置中使用了监听器$('.lblName').text(function () { return $(this).text().substr(0, 5); }); ,它在扩展组合框列表时过滤商店。

expand