Browse Source

bordered table

pull/124/head
afc163 9 years ago
parent
commit
137e40acae
  1. 41
      components/table/demo/bordered.md
  2. 6
      components/table/index.jsx
  3. 19
      style/components/table.less

41
components/table/demo/bordered.md

@ -0,0 +1,41 @@
# 边框
- order: 11
添加表格边框线,`bordered={true}`。
---
````jsx
var Table = antd.Table;
var columns = [{
title: '姓名',
dataIndex: 'name',
render: function(text) {
return <a href="javascript:;">{text}</a>;
}
}, {
title: '年龄',
dataIndex: 'age'
}, {
title: '住址',
dataIndex: 'address'
}];
var data = [{
name: '胡彦斌',
age: 32,
address: '西湖区湖底公园1号'
}, {
name: '胡彦祖',
age: 42,
address: '西湖区湖底公园1号'
}, {
name: '李大嘴',
age: 32,
address: '西湖区湖底公园1号'
}];
React.render(<Table columns={columns} dataSource={data} bordered={true} />
, document.getElementById('components-table-demo-bordered'));
````

6
components/table/index.jsx

@ -64,7 +64,8 @@ var AntTable = React.createClass({
prefixCls: 'ant-table',
useFixedHeader: false,
rowSelection: null,
size: 'normal'
size: 'normal',
bordered: false
};
},
@ -464,6 +465,9 @@ var AntTable = React.createClass({
if (this.props.size === 'small') {
classString += ' ant-table-small';
}
if (this.props.bordered) {
classString += ' ant-table-bordered';
}
columns = this.renderColumnsDropdown(columns);
return <div className="clearfix">
<Table

19
style/components/table.less

@ -12,7 +12,7 @@
table {
width: 100%;
max-width: 100%;
border-collapse: separate;
border-collapse: collapse;
text-align: left;
}
@ -180,6 +180,23 @@
}
}
}
&.@{tablePrefixClass}-bordered {
border: 1px solid #E9E9E9;
border-bottom: 0;
overflow: hidden;
th {
border-bottom: 1px solid #E9E9E9;
}
th, td {
border-right: 1px solid #E9E9E9;
&:last-child {
border-right: 0;
}
}
}
}
.@{tablePrefixClass}-pagination {

Loading…
Cancel
Save