Skip to content

Commit

Permalink
Merge pull request #368 from youzan/hotfix/fix-table-style
Browse files Browse the repository at this point in the history
table: 修复pageInfo传null的报错和money class的对齐问题
  • Loading branch information
cpylua authored Jul 10, 2017
2 parents 8a79527 + 3678bd3 commit fdb1682
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
3 changes: 2 additions & 1 deletion packages/zent/src/table/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const columns = [{
title: '库存',
name: 'stock_num',
width: '100px',
textAlign: 'center',
isMoney: true,
isMoney: true
}, {
width: '3em',
Expand All @@ -55,6 +55,7 @@ const columns = [{
ReactDOM.render(
<Table
columns={columns}
pageInfo={null}
datasets={datasets}
rowKey="item_id"
/>
Expand Down
10 changes: 3 additions & 7 deletions packages/zent/src/table/modules/Foot.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,11 @@ export default class Foot extends (PureComponent || Component) {
};

render() {
const {
pageInfo = {},
onPageChange,
batchComponents,
selection,
current
} = this.props;
const { onPageChange, batchComponents, selection, current } = this.props;

let pageInfo = this.props.pageInfo || {};
let { totalItem, pageSize, total, limit, maxPageToShow } = pageInfo;

const { needSelect, selectedRows } = selection;
let batchClassName = 'tfoot__batchcomponents';
const shouldRenderFoot =
Expand Down
10 changes: 7 additions & 3 deletions packages/zent/src/table/modules/Head.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,16 @@ export default class Head extends (PureComponent || Component) {
};
}

cellClass += ` cell--${helper.getAlignClass(textAlign)}`;
if (helper.getAlignClass(textAlign) !== '') {
cellClass += ` cell--${helper.getAlignClass(textAlign)}`;
}

tds.push(
<div key={index} className={cellClass} style={styleObj}>
{this.renderCheckBox(index, selection)}
{this.getChild(item)}
<div className="cell__child-container">
{this.renderCheckBox(index, selection)}
{this.getChild(item)}
</div>
</div>
);
});
Expand Down
4 changes: 3 additions & 1 deletion packages/zent/src/table/modules/Td.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,9 @@ export default class Td extends (PureComponent || Component) {
};
}

className += ` cell--${helper.getAlignClass(textAlign)}`;
if (helper.getAlignClass(textAlign) !== '') {
className += ` cell--${helper.getAlignClass(textAlign)}`;
}

return (
<div className={className} style={styleObj}>
Expand Down

0 comments on commit fdb1682

Please sign in to comment.