mirror of
https://github.com/ant-design/ant-design.git
synced 2025-08-06 16:06:28 +08:00
docs: Reset filters and sorters - English Translation (#3259)
This commit is contained in:
parent
94f2d08978
commit
5d914d6ba3
@ -30,24 +30,24 @@ import { Table } from 'antd';
|
||||
|
||||
const data = [{
|
||||
key: '1',
|
||||
name: '胡斌',
|
||||
name: 'John Brown',
|
||||
age: 32,
|
||||
address: '南湖区湖底公园1号',
|
||||
address: 'New York No. 1 Lake Park',
|
||||
}, {
|
||||
key: '2',
|
||||
name: '胡彦祖',
|
||||
name: 'Jim Green',
|
||||
age: 42,
|
||||
address: '西湖区湖底公园12号',
|
||||
address: 'London No. 1 Lake Park',
|
||||
}, {
|
||||
key: '3',
|
||||
name: '李大嘴',
|
||||
name: 'Joe Black',
|
||||
age: 32,
|
||||
address: '南湖区湖底公园123号',
|
||||
address: 'Sidney No. 1 Lake Park',
|
||||
}, {
|
||||
key: '4',
|
||||
name: '李秀莲大嘴哥',
|
||||
name: 'Jim Red',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园123号',
|
||||
address: 'London No. 2 Lake Park',
|
||||
}];
|
||||
|
||||
const App = React.createClass({
|
||||
@ -58,7 +58,7 @@ const App = React.createClass({
|
||||
};
|
||||
},
|
||||
handleChange(pagination, filters, sorter) {
|
||||
console.log('各类参数是', pagination, filters, sorter);
|
||||
console.log('Various parameters', pagination, filters, sorter);
|
||||
this.setState({
|
||||
filteredInfo: filters,
|
||||
sortedInfo: sorter,
|
||||
@ -89,30 +89,30 @@ const App = React.createClass({
|
||||
sortedInfo = sortedInfo || {};
|
||||
filteredInfo = filteredInfo || {};
|
||||
const columns = [{
|
||||
title: '姓名',
|
||||
title: 'Name',
|
||||
dataIndex: 'name',
|
||||
key: 'name',
|
||||
filters: [
|
||||
{ text: '姓李的', value: '李' },
|
||||
{ text: '姓胡的', value: '胡' },
|
||||
{ text: 'Joe', value: 'Joe' },
|
||||
{ text: 'Jim', value: 'Jim' },
|
||||
],
|
||||
filteredValue: filteredInfo.name,
|
||||
onFilter: (value, record) => record.name.includes(value),
|
||||
sorter: (a, b) => a.name.length - b.name.length,
|
||||
sortOrder: sortedInfo.columnKey === 'name' && sortedInfo.order,
|
||||
}, {
|
||||
title: '年龄',
|
||||
title: 'Age',
|
||||
dataIndex: 'age',
|
||||
key: 'age',
|
||||
sorter: (a, b) => a.age - b.age,
|
||||
sortOrder: sortedInfo.columnKey === 'age' && sortedInfo.order,
|
||||
}, {
|
||||
title: '地址',
|
||||
title: 'Address',
|
||||
dataIndex: 'address',
|
||||
key: 'address',
|
||||
filters: [
|
||||
{ text: '南湖', value: '南湖' },
|
||||
{ text: '西湖', value: '西湖' },
|
||||
{ text: 'London', value: 'London' },
|
||||
{ text: 'New York', value: 'New York' },
|
||||
],
|
||||
filteredValue: filteredInfo.address,
|
||||
onFilter: (value, record) => record.address.includes(value),
|
||||
@ -122,9 +122,9 @@ const App = React.createClass({
|
||||
return (
|
||||
<div>
|
||||
<div className="table-operations">
|
||||
<a href="#" onClick={this.setAgeSort}>年龄降序排序</a>
|
||||
<a href="#" onClick={this.clearFilters}>清除筛选</a>
|
||||
<a href="#" onClick={this.clearAll}>清除筛选和排序</a>
|
||||
<a href="#" onClick={this.setAgeSort}>Age descending order</a>
|
||||
<a href="#" onClick={this.clearFilters}>Clear filters</a>
|
||||
<a href="#" onClick={this.clearAll}>Clear filters and sorting</a>
|
||||
</div>
|
||||
<Table columns={columns} dataSource={data} onChange={this.handleChange} />
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user