Fix columns[0] undefined bug in Table

This commit is contained in:
afc163 2016-03-02 16:01:36 +08:00
parent 8070e05de1
commit 9b09e54df5

View File

@ -374,8 +374,7 @@ let AntTable = React.createClass({
className: 'ant-table-selection-column' className: 'ant-table-selection-column'
}; };
} }
if (columns[0] && if (columns[0] && columns[0].key === 'selection-column') {
columns[0].key === 'selection-column') {
columns[0] = selectionColumn; columns[0] = selectionColumn;
} else { } else {
columns.unshift(selectionColumn); columns.unshift(selectionColumn);
@ -587,7 +586,7 @@ let AntTable = React.createClass({
data={data} data={data}
columns={columns} columns={columns}
className={classString} className={classString}
expandIconColumnIndex={columns[0].key === 'selection-column' ? 1 : 0} expandIconColumnIndex={(columns[0] && columns[0].key === 'selection-column') ? 1 : 0}
expandIconAsCell={expandIconAsCell} /> expandIconAsCell={expandIconAsCell} />
{emptyText} {emptyText}
</div> </div>