提交 222545b7 编写于 作者: Y yiminghe

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

......@@ -60,7 +60,7 @@ var dataSource = new Table.DataSource({
}
});
var Test=React.createClass({
var Test = React.createClass({
getInitialState() {
return {
dataSource: dataSource
......@@ -68,14 +68,28 @@ var Test=React.createClass({
},
refresh() {
this.setState({
dataSource: this.state.dataSource.clone()
dataSource: dataSource.clone()
});
},
changeAndRefresh() {
// 可以修改原来的 dataSource 再发请求
this.setState({
dataSource: dataSource.clone({
data: {
city: 'hz'
}
})
});
},
render() {
return <div>
<Table columns={columns} dataSource={this.state.dataSource} />
<button className="ant-btn ant-btn-primary" onClick={this.refresh}>
外部重新加载数据
重新加载数据
</button>
&nbsp;
<button className="ant-btn" onClick={this.changeAndRefresh}>
加载 city=hz 的数据
</button>
</div>;
}
......
# 边框
- 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'));
````
......@@ -23,6 +23,7 @@ class DataSource {
this.getParams = config.getParams || noop;
this.getPagination = config.getPagination || noop;
this.headers = config.headers || {};
this.data = config.data || {};
}
constructor(config) {
......@@ -31,10 +32,12 @@ class DataSource {
}
}
clone() {
var d = new DataSource();
d.init(this.config);
return d;
clone(config) {
if (config) {
return new DataSource(objectAssign(config, this.config));
} else {
return this;
}
}
}
......@@ -61,7 +64,8 @@ var AntTable = React.createClass({
prefixCls: 'ant-table',
useFixedHeader: false,
rowSelection: null,
size: 'normal'
size: 'normal',
bordered: false
};
},
......@@ -358,9 +362,10 @@ var AntTable = React.createClass({
}
// remote 模式使用 this.dataSource
let dataSource = this.getRemoteDataSource();
let buildInParams = dataSource.getParams.apply(this, this.prepareParamsArguments(state)) || {};
return jQuery.ajax({
url: dataSource.url,
data: dataSource.getParams.apply(this, this.prepareParamsArguments(state)) || {},
data: objectAssign(buildInParams, dataSource.data),
headers: dataSource.headers,
dataType: 'json',
success: (result) => {
......@@ -460,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
......
......@@ -2,6 +2,7 @@
- category: Components
- chinese: 树
- disabled: true
---
......
......@@ -46,6 +46,12 @@
$ npm install antd --save
```
安装最新的开发版本:
```bash
$ npm install antd@beta --save
```
## 开发工具
Ant Design 提供了开发构建的命令行工具,可以安装到全局直接使用:
......
......@@ -35,11 +35,11 @@
&-item-active,
&-submenu-active,
&-submenu-inline&-submenu-active > &-submenu-title:hover {
background-color: #eaf8fe;
background-color: tint(@primary-color, 90%);
}
&-item-selected {
background-color: #eaf8fe;
background-color: tint(@primary-color, 90%);
}
& > li&-submenu {
......@@ -123,9 +123,9 @@
border-bottom: 2px solid transparent;
&-active {
border-bottom: 2px solid #2db7f5;
border-bottom: 2px solid @primary-color;
background-color: #F3F5F7;
color: #2baee9;
color: @primary-color;
}
}
......
......@@ -40,8 +40,8 @@
}
&-checked{
border: 1px solid @success-color;
background-color: @success-color;
border: 1px solid @primary-color;
background-color: @primary-color;
.@{switchPrefixCls}-inner {
left:6px;
......
......@@ -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 {
......
......@@ -23,7 +23,7 @@
@icon-url : "//at.alicdn.com/t/font_1437110976_60069";
// LINK
@link-color : @primary-color;
@link-color : #2db7f5;
@link-hover-color : tint(@link-color, 20%);
@link-active-color : shade(@link-color, 5%);
@link-hover-decoration : none;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册