Merge branch 'develop-0.10.0' of github.com:ant-design/ant-design into develop-0.10.0

This commit is contained in:
afc163 2015-10-21 20:42:59 +08:00
commit 7ff8459090
3 changed files with 27 additions and 14 deletions

View File

@ -64,6 +64,11 @@ var data = [{
address: '西湖区湖底公园123号' address: '西湖区湖底公园123号'
}]; }];
ReactDOM.render(<Table columns={columns} dataSource={data} /> function onChange(pagination, filters, sorter) {
// 点击分页、筛选、排序时触发
console.log('各类参数是', pagination, filters, sorter);
}
ReactDOM.render(<Table columns={columns} dataSource={data} onChange={onChange} />
, document.getElementById('components-table-demo-head')); , document.getElementById('components-table-demo-head'));
```` ````

View File

@ -65,7 +65,8 @@ let AntTable = React.createClass({
useFixedHeader: false, useFixedHeader: false,
rowSelection: null, rowSelection: null,
size: 'normal', size: 'normal',
bordered: false bordered: false,
onChange: function() {}
}; };
}, },
@ -153,21 +154,25 @@ let AntTable = React.createClass({
} }
}; };
} }
this.fetch({ const newState = {
sortOrder: sortOrder, sortOrder,
sortColumn: sortColumn, sortColumn,
sorter: sorter sorter
}); };
this.fetch(newState);
this.props.onChange.apply(this, this.prepareParamsArguments(objectAssign({}, this.state, newState)));
}, },
handleFilter(column, filters) { handleFilter(column, filters) {
filters = objectAssign({}, this.state.filters, { filters = objectAssign({}, this.state.filters, {
[this.getColumnKey(column)]: filters [this.getColumnKey(column)]: filters
}); });
this.fetch({ const newState = {
selectedRowKeys: [], selectedRowKeys: [],
filters: filters filters
}); };
this.fetch(newState);
this.props.onChange.apply(this, this.prepareParamsArguments(objectAssign({}, this.state, newState)));
}, },
handleSelect(record, rowIndex, e) { handleSelect(record, rowIndex, e) {
@ -251,11 +256,13 @@ let AntTable = React.createClass({
} else { } else {
pagination.current = pagination.current || 1; pagination.current = pagination.current || 1;
} }
this.fetch({ const newState = {
// //
selectedRowKeys: [], selectedRowKeys: [],
pagination: pagination pagination
}); };
this.fetch(newState);
this.props.onChange.apply(this, this.prepareParamsArguments(objectAssign({}, this.state, newState)));
}, },
onRadioChange: function (ev) { onRadioChange: function (ev) {

View File

@ -66,8 +66,9 @@ var dataSource = new Table.DataSource({
| size | 正常或迷你类型 | String | `normal` or `small` | normal | | size | 正常或迷你类型 | String | `normal` or `small` | normal |
| dataSource | 数据源,可以为数组(本地模式)或一个数据源描述对象(远程模式) | Array or Object | | | | dataSource | 数据源,可以为数组(本地模式)或一个数据源描述对象(远程模式) | Array or Object | | |
| columns | 表格列的配置描述,具体项见下表 | Array | | 无 | | columns | 表格列的配置描述,具体项见下表 | Array | | 无 |
| rowKey | 表格列 key 的取值 | Function(recode,index):string | | record.key | | rowKey | 表格列 key 的取值 | Function(recode, index):string | | record.key |
| expandIconAsCell | 设置展开 Icon 是否单独一列 | Boolean | | true | | expandIconAsCell | 设置展开 Icon 是否单独一列 | Boolean | | true |
| onChange | 分页、排序、筛选变化时触发 | Function(pagination, filters, sorter) | | |
### Column ### Column