react table filters筛选用法

1.
filters的数据是数组,把获取相应的数组使用map方法,将数据转换为text:,value:,
再将onFilter:(value,record) => { 
    return record.  = value
}
例子:

store:

let type = [];
            for (var key in x.data.category) {
                if (x.data.category.hasOwnProperty(key)) {
                    type.push({
                        name: x.data.category[key].name,
                        id: key
                    })
                }
            }
            this.skuType = type.map(x => ({ text:x.name, value:x.id }));
{
            title: '分类',
            dataIndex: 'catename',
            key: '分类',
            filters: toJS(this.props.sku.skuType) || [],
            onFilter: (value, record) => {
                return record.cateid === value},
        }

猜你喜欢

转载自blog.csdn.net/Lei_zhen96/article/details/78740508
0条评论
添加一条新回复