This commit is contained in:
wanghaoo 2018-10-11 22:52:54 +08:00
commit 83fed7b012
6 changed files with 80 additions and 47 deletions

View File

@ -144,8 +144,21 @@ class Demo27 extends Component {
}
},
{ title: "姓名", width: 180, dataIndex: "name", key: "name", filterType: "text", filterDropdown: "show" },
{ title: "年龄", width: 150, sorter: (a, b) => a.age - b.age, dataIndex: "age", key: "age", filterType: "dropdown", filterDropdown: "show" },
{ title: "居住地址", width: 150, dataIndex: "address", key: "address", filterType: "dropdown", filterDropdown: "show" },
{
title: "年龄",
width: 150,
sorter: (a, b) => a.age - b.age,
dataIndex: "age",
key: "age",
filterType: "dropdown",
filterDropdown: "hide",
filterDropdownAuto: "manual",//切换手动传入模式
filterDropdownData: [{
key: '数据',
value: '数据'
}]
},
{ title: "居住地址", width: 150, dataIndex: "address", key: "address", filterType: "dropdown", filterDropdown: "hide" },
];
return <ComplexTable
onFilterRowsDropChange={this.handlerFilterRowsDropChange}//下拉条件的回调(key,val)=>()

File diff suppressed because one or more lines are too long

40
dist/demo.js vendored

File diff suppressed because one or more lines are too long

2
dist/demo.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -349,7 +349,9 @@ class Table extends Component {
dataindex: column.dataIndex,
datasource: this.props.data,
format: column.format,
filterdropdown: column.filterDropdown
filterdropdown: column.filterDropdown,
filterdropdownauto: column.filterDropdownAuto,//是否自定义数据
filterdropdowndata: column.filterDropdownData//自定义数据格式
});
}
});

View File

@ -247,7 +247,7 @@ class TableHeader extends Component {
//下拉框选择
case 'dropdown':
let selectDataSource = [];
if (rows.length > 0) {
if (rows.length > 0 && (rows[1][index]['filterdropdownauto'] || 'auto') == 'auto') {
let hash = {};
//处理下拉重复对象组装dropdown
selectDataSource = Array.from(rows[1][0].datasource, x => ({ key: x[dataIndex], value: x[dataIndex] }));
@ -255,6 +255,8 @@ class TableHeader extends Component {
hash[next.key] ? '' : hash[next.key] = true && item.push(next);
return item
}, []);
} else {
selectDataSource = rows[1][index]['filterdropdowndata']
}
return <FilterType
rendertype={type}