sort demo

This commit is contained in:
afc163 2015-07-13 10:29:53 +08:00
parent b9069c3a8e
commit b53e76afff
2 changed files with 40 additions and 0 deletions

View File

@ -20,6 +20,7 @@ var columns = [{
}];
function resolve(result) {
console.log(this.loadData);
return result.data;
}

View File

@ -7,4 +7,43 @@
---
````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'));
````