mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 11:08:45 +08:00
Fix table key warning
This commit is contained in:
parent
74b0bb28d1
commit
90e8296949
@ -36,14 +36,17 @@ var columns = [{
|
||||
}
|
||||
}];
|
||||
var data = [{
|
||||
key: '1',
|
||||
name: '胡彦斌',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园1号'
|
||||
}, {
|
||||
key: '2',
|
||||
name: '胡彦祖',
|
||||
age: 42,
|
||||
address: '西湖区湖底公园1号'
|
||||
}, {
|
||||
key: '3',
|
||||
name: '李大嘴',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园1号'
|
||||
|
@ -23,14 +23,17 @@ var columns = [{
|
||||
}];
|
||||
|
||||
var data = [{
|
||||
key: '1',
|
||||
name: '胡彦斌',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园1号'
|
||||
}, {
|
||||
key: '2',
|
||||
name: '胡彦祖',
|
||||
age: 42,
|
||||
address: '西湖区湖底公园1号'
|
||||
}, {
|
||||
key: '3',
|
||||
name: '李大嘴',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园1号'
|
||||
|
@ -1,41 +1,51 @@
|
||||
{
|
||||
"data": [{
|
||||
"key": "1",
|
||||
"name": "胡彦斌ajax1",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "2",
|
||||
"name": "胡彦祖ajax2",
|
||||
"age": 42,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "3",
|
||||
"name": "李大嘴ajax3",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "4",
|
||||
"name": "李大嘴ajax4",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "5",
|
||||
"name": "李大嘴ajax5",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "6",
|
||||
"name": "李大嘴ajax6",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "7",
|
||||
"name": "李大嘴ajax7",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "8",
|
||||
"name": "李大嘴ajax8",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "9",
|
||||
"name": "李大嘴ajax9",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
}, {
|
||||
"key": "10",
|
||||
"name": "李大嘴ajax10",
|
||||
"age": 32,
|
||||
"address": "西湖区湖底公园1号"
|
||||
|
@ -43,18 +43,22 @@ var columns = [{
|
||||
}];
|
||||
|
||||
var data = [{
|
||||
key: '1',
|
||||
name: '胡斌',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园1号'
|
||||
}, {
|
||||
key: '2',
|
||||
name: '胡彦祖',
|
||||
age: 42,
|
||||
address: '西湖区湖底公园12号'
|
||||
}, {
|
||||
key: '3',
|
||||
name: '李大嘴',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园123号'
|
||||
}, {
|
||||
key: '4',
|
||||
name: '李秀莲大嘴哥',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园123号'
|
||||
|
@ -22,34 +22,38 @@ var columns = [{
|
||||
dataIndex: 'address'
|
||||
}];
|
||||
var data1 = [{
|
||||
key: '1',
|
||||
name: '胡彦斌',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园1号'
|
||||
}, {
|
||||
key: '2',
|
||||
name: '胡彦祖',
|
||||
age: 42,
|
||||
address: '西湖区湖底公园1号'
|
||||
}, {
|
||||
key: '3',
|
||||
name: '李大嘴',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园1号'
|
||||
}];
|
||||
var data2 = [{
|
||||
key: '11',
|
||||
name: '胡彦斌2',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园2号'
|
||||
}, {
|
||||
key: '22',
|
||||
name: '胡彦祖2',
|
||||
age: 42,
|
||||
address: '西湖区湖底公园2号'
|
||||
}, {
|
||||
key: '33',
|
||||
name: '李大嘴2',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园2号'
|
||||
}];
|
||||
|
||||
|
||||
|
||||
var App = React.createClass({
|
||||
getInitialState() {
|
||||
return {
|
||||
|
@ -20,14 +20,17 @@ var columns = [{
|
||||
}];
|
||||
|
||||
var data = [{
|
||||
key: '1',
|
||||
name: '胡彦斌',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园1号'
|
||||
}, {
|
||||
key: '2',
|
||||
name: '胡彦祖',
|
||||
age: 42,
|
||||
address: '西湖区湖底公园1号'
|
||||
}, {
|
||||
key: '3',
|
||||
name: '李大嘴',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园1号'
|
||||
|
@ -26,6 +26,7 @@ var data = [];
|
||||
|
||||
for (let i=0; i<46; i++) {
|
||||
data.push({
|
||||
key: i,
|
||||
name: '李大嘴' + i,
|
||||
age: 32,
|
||||
address: '西湖区湖底公园' + i + '号'
|
||||
|
@ -22,14 +22,17 @@ var columns = [{
|
||||
dataIndex: 'address'
|
||||
}];
|
||||
var data = [{
|
||||
key: '1',
|
||||
name: '胡彦斌',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园1号'
|
||||
}, {
|
||||
key: '2',
|
||||
name: '胡彦祖',
|
||||
age: 42,
|
||||
address: '西湖区湖底公园1号'
|
||||
}, {
|
||||
key: '3',
|
||||
name: '李大嘴',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园1号'
|
||||
|
@ -19,14 +19,17 @@ var columns = [{
|
||||
dataIndex: 'address'
|
||||
}];
|
||||
var data = [{
|
||||
key: '1',
|
||||
name: '胡彦斌',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园1号'
|
||||
}, {
|
||||
key: '2',
|
||||
name: '胡彦祖',
|
||||
age: 42,
|
||||
address: '西湖区湖底公园1号'
|
||||
}, {
|
||||
key: '3',
|
||||
name: '李大嘴',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园1号'
|
||||
|
@ -295,11 +295,11 @@ var AntTable = React.createClass({
|
||||
</span>
|
||||
</div>;
|
||||
}
|
||||
column.title = [
|
||||
column.title,
|
||||
sortButton,
|
||||
filterDropdown
|
||||
];
|
||||
column.title = <div>
|
||||
{column.title}
|
||||
{sortButton}
|
||||
{filterDropdown}
|
||||
</div>;
|
||||
return column;
|
||||
});
|
||||
},
|
||||
@ -467,6 +467,10 @@ var AntTable = React.createClass({
|
||||
classString += ' ant-table-bordered';
|
||||
}
|
||||
columns = this.renderColumnsDropdown(columns);
|
||||
columns = columns.map((column, i) => {
|
||||
column.key = column.dataIndex || i;
|
||||
return column;
|
||||
});
|
||||
return <div className="clearfix">
|
||||
<Table
|
||||
{...this.props}
|
||||
|
@ -24,10 +24,12 @@ Table 有两种模式,本地数据和远程数据模式。
|
||||
|
||||
```jsx
|
||||
var dataSource = [{
|
||||
key: '1',
|
||||
name: '胡彦斌',
|
||||
age: 32,
|
||||
address: '西湖区湖底公园1号'
|
||||
}, {
|
||||
key: '2',
|
||||
name: '胡彦祖',
|
||||
age: 42,
|
||||
address: '西湖区湖底公园1号'
|
||||
@ -64,6 +66,7 @@ var dataSource = new Table.DataSource({
|
||||
| size | 正常或迷你类型 | string | `normal` or `small` | normal |
|
||||
| dataSource | 数据源,可以为数组(本地模式)或一个数据源描述对象(远程模式) | Array or Object | | |
|
||||
| columns | 表格列的配置描述,具体项见下表 | Array | | 无 |
|
||||
| rowKey | 表格列 key 的取值 | Function(recode,index):string | | record.key |
|
||||
|
||||
### Column
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user