mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-05 15:39:45 +08:00
sort demo
This commit is contained in:
parent
b9069c3a8e
commit
b53e76afff
@ -20,6 +20,7 @@ var columns = [{
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
function resolve(result) {
|
function resolve(result) {
|
||||||
|
console.log(this.loadData);
|
||||||
return result.data;
|
return result.data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,4 +7,43 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
````jsx
|
````jsx
|
||||||
|
var Table = antd.Table;
|
||||||
|
var columns = [{
|
||||||
|
title: '姓名',
|
||||||
|
dataIndex: 'name'
|
||||||
|
}, {
|
||||||
|
title: '年龄',
|
||||||
|
dataIndex: 'age',
|
||||||
|
filter: function() {
|
||||||
|
return [{
|
||||||
|
text: '选项一'
|
||||||
|
value: 'value1'
|
||||||
|
}, {
|
||||||
|
text: '选项二'
|
||||||
|
value: 'value2'
|
||||||
|
}];
|
||||||
|
},
|
||||||
|
onFilter: function(item) {
|
||||||
|
this.props.dataSource += '?age=' + item.value;
|
||||||
|
this.loadData();
|
||||||
|
},
|
||||||
|
onSorter: function(a, b) {
|
||||||
|
return a > b;
|
||||||
|
}
|
||||||
|
}, {
|
||||||
|
title: '地址',
|
||||||
|
dataIndex: 'address'
|
||||||
|
}];
|
||||||
|
var data = [{
|
||||||
|
name: '胡彦斌',
|
||||||
|
age: 32,
|
||||||
|
address: '西湖区湖底公园1号'
|
||||||
|
}, {
|
||||||
|
name: '胡彦祖',
|
||||||
|
age: 42,
|
||||||
|
address: '西湖区湖底公园1号'
|
||||||
|
}];
|
||||||
|
|
||||||
|
React.render(<Table columns={columns} data={data} />
|
||||||
|
, document.getElementById('components-table-demo-sort'));
|
||||||
````
|
````
|
||||||
|
Loading…
Reference in New Issue
Block a user