diff --git a/src/Table.jsx b/src/Table.jsx index 3c7cf935..87a545cb 100644 --- a/src/Table.jsx +++ b/src/Table.jsx @@ -225,9 +225,11 @@ export default class Table extends React.Component { rows.push([]); } } + const styleProp = column.align ? { textAlign: column.align } : null; const cell = { key: column.key, className: column.className || '', + style: styleProp, children: column.title, }; if (column.children) { diff --git a/src/TableCell.jsx b/src/TableCell.jsx index 797e1e5e..9dc04d75 100644 --- a/src/TableCell.jsx +++ b/src/TableCell.jsx @@ -28,7 +28,9 @@ export default class TableCell extends React.Component { render() { const { record, indentSize, prefixCls, indent, index, expandIcon, column } = this.props; - const { dataIndex, render, className = '' } = column; + const { dataIndex, render, className = '', align } = column; + + const styleProp = align ? { textAlign: align } : null; // We should return undefined if no dataIndex is specified, but in order to // be compatible with object-path's behavior, we return the record object instead. @@ -72,6 +74,7 @@ export default class TableCell extends React.Component { return (