Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
2betop committed Mar 23, 2016
1 parent 8420ad5 commit 32ae428
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 12 deletions.
36 changes: 30 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ var table = React.render(
<th>false</th>
<td>whether use separator table for header. better set width for columns</td>
</tr>
<tr>
<td>scroll</td>
<td>Object</td>
<th>{x: false, y: false}</th>
<td>whether table can be scroll in x/y direction, `y` can be a number that indicated the height of table body</td>
</tr>
<tr>
<td>expandIconAsCell</td>
<td>Boolean</td>
Expand Down Expand Up @@ -186,17 +192,29 @@ var table = React.render(
<th></th>
<td>handle rowClick action, index means the index of current row among fatherElement[childrenColumnName]</td>
</tr>
<tr>
<td>columnsPageSize</td>
<td>Number</td>
<th>5</th>
<td>pageSize of columns. (Deprecated, use fixed columns)</td>
</tr>
<tr>
<td>columnsPageRange</td>
<td>Array</td>
<th></th>
<td>columns index range need paging, like [2,10]</td>
<td>columns index range need paging, like [2,10]. (Deprecated, use column.fixed)</td>
</tr>
<tr>
<td>columnsPageSize</td>
<td>Number</td>
<th>5</th>
<td>pageSize of columns</td>
<td>showHeader</td>
<td>Boolean</td>
<th>true</th>
<td>whether table head is shown</td>
</tr>
<tr>
<td>footer</td>
<td>Function(currentData)</td>
<th></th>
<td>table footer render function</td>
</tr>
<tr>
<td>columns</td>
Expand Down Expand Up @@ -242,7 +260,13 @@ var table = React.render(
<td>width</td>
<td>String|Number</td>
<th></th>
<td>he width of the specific proportion calculation according to the width of the columns</td>
<td>width of the specific proportion calculation according to the width of the columns</td>
</tr>
<tr>
<td>fixed</td>
<td>String|Boolean</td>
<th></th>
<td>this column will be fixed when table scroll horizontally: true or 'left' or 'right'</td>
</tr>
<tr>
<td>render</td>
Expand Down
2 changes: 1 addition & 1 deletion component.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "./lib/index",
"tag": "master",
"reposType": "npm",
"version": "3.10.1",
"version": "3.11.1",
"dependencies": {
"object-assign": "^4.0.1"
}
Expand Down
26 changes: 21 additions & 5 deletions lib/Table.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ var Table = _react2['default'].createClass({
onRowClick: _react2['default'].PropTypes.func,
columnsPageRange: _react2['default'].PropTypes.array,
columnsPageSize: _react2['default'].PropTypes.number,
expandIconColumnIndex: _react2['default'].PropTypes.number
expandIconColumnIndex: _react2['default'].PropTypes.number,
showHeader: _react2['default'].PropTypes.bool,
footer: _react2['default'].PropTypes.func
},

getDefaultProps: function getDefaultProps() {
Expand All @@ -66,7 +68,8 @@ var Table = _react2['default'].createClass({
childrenColumnName: 'children',
indentSize: 15,
columnsPageSize: 5,
expandIconColumnIndex: 0
expandIconColumnIndex: 0,
showHeader: true
};
},

Expand Down Expand Up @@ -366,15 +369,15 @@ var Table = _react2['default'].createClass({
className += ' ' + prefixCls + '-columns-paging';
}
var headerTable = undefined;
var thead = _react2['default'].createElement(
var thead = props.showHeader ? _react2['default'].createElement(
'thead',
{ className: prefixCls + '-thead' },
_react2['default'].createElement(
'tr',
null,
columns
)
);
) : null;
if (props.useFixedHeader) {
headerTable = _react2['default'].createElement(
'div',
Expand Down Expand Up @@ -404,7 +407,20 @@ var Table = _react2['default'].createClass({
'tbody',
{ className: prefixCls + '-tbody' },
rows
)
),
props.footer ? _react2['default'].createElement(
'tfoot',
{ className: prefixCls + '-tfoot' },
_react2['default'].createElement(
'tr',
null,
_react2['default'].createElement(
'td',
{ colSpan: '0' },
props.footer(this.state.data)
)
)
) : null
)
)
);
Expand Down

0 comments on commit 32ae428

Please sign in to comment.