diff --git a/src/Table.jsx b/src/Table.jsx
index d7e27881a..4eef17ab2 100644
--- a/src/Table.jsx
+++ b/src/Table.jsx
@@ -59,19 +59,29 @@ class Table extends React.Component {
}
getThs() {
- return this.props.columns.map((c)=> {
+ var expandIconAsCell = this.props.expandIconAsCell === false ? false : true;
+ var ths = [];
+ if (expandIconAsCell) {
+ ths.push({
+ title: ''
+ });
+ }
+ ths = ths.concat(this.props.columns);
+ return ths.map((c)=> {
return
{c.title} | ;
});
}
getExpandedRow(key, content, visible, className) {
+ var expandIconAsCell = this.props.expandIconAsCell === false ? false : true;
var prefixCls = this.props.prefixCls;
if (key) {
key += '-extra-row';
}
return
+ {expandIconAsCell ? | : ''}
- {content}
+ {content}
|
;
}
@@ -81,6 +91,7 @@ class Table extends React.Component {
var columns = props.columns;
var childrenColumnName = props.childrenColumnName;
var expandedRowRender = props.expandedRowRender;
+ var expandIconAsCell = props.expandIconAsCell;
var rst = [];
var keyFn = props.rowKey;
var rowClassName = props.rowClassName;
@@ -97,6 +108,7 @@ class Table extends React.Component {
rst.push(
-
- {columns}
-
+
+ {columns}
+
;
if (props.useFixedHeader) {
headerTable =
- {this.getColGroup()}
+ {this.getColGroup()}
{thead}
;
@@ -157,11 +169,11 @@ class Table extends React.Component {
}
return (
- {headerTable}
+ {headerTable}
- {this.getColGroup()}
- {thead}
+ {this.getColGroup()}
+ {thead}
{rows}
diff --git a/src/TableRow.jsx b/src/TableRow.jsx
index ae9f93caf..a7b7a7efb 100644
--- a/src/TableRow.jsx
+++ b/src/TableRow.jsx
@@ -15,27 +15,53 @@ class TableRow extends React.Component {
var index = props.index;
var cells = [];
var expanded = props.expanded;
- for (var i = 0; i < columns.length; i++) {
- var col = columns[i];
- var colClassName = col.className || '';
- var render = col.render;
- var text = record[col.dataIndex];
+ var expandable = props.expandable;
+ var expandIconAsCell = props.expandIconAsCell === false ? false : true;
+
+ if (expandIconAsCell) {
+ if (expandable) {
+ cells.push(
+ {}
+ | );
+ } else {
+ cells.push( | );
+ }
+ if (!columns[0].title) {
+ columns.shift();
+ }
+ } else {
+ let col = columns[0];
+ let text = record[col.dataIndex];
+ if (expandable) {
+ cells.push(
+ {}
+ {text}
+ | );
+ } else {
+ cells.push({text} | );
+ }
+ }
+
+ for (var i = expandIconAsCell ? 0 : 1; i < columns.length; i++) {
+ let col = columns[i];
+ let colClassName = col.className || '';
+ let render = col.render;
+ let text = record[col.dataIndex];
if (render) {
text = render(text, record, index);
}
- var expandIcon = null;
- if (props.expandable && i === 0) {
- expandIcon = ;
- }
cells.push(
- {expandIcon}
- {text}
+ {text}
| );
}
- return ({cells}
);
+ return (
+ {cells}
);
}
}