Skip to content

Commit

Permalink
feat: 新增sumRender自定义列合计render函数
Browse files Browse the repository at this point in the history
  • Loading branch information
lucian55 committed Jul 9, 2020
1 parent aed4d44 commit 4c6f69f
Show file tree
Hide file tree
Showing 6 changed files with 218,117 additions and 17 deletions.
237 changes: 237 additions & 0 deletions dist/demo.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/demo.css.map

Large diffs are not rendered by default.

217,885 changes: 217,871 additions & 14 deletions dist/demo.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/demo.js.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ import 'bee-table/build/Table.css';
| isShow | 是否展示该列数据 | bool | true |
| cellMenu | 渲染单元格内操作按钮 | object | - |
| style | 该列的样式,严格按照react的样式书写规则,即对象内每一个属性的键为小写驼峰式,值为字符串 | object | - |
| sumRender | 自定义合计render函数 | func(value) | - |

#### [v2.2.x新增] cellMenu

Expand Down
7 changes: 6 additions & 1 deletion src/lib/sum.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,12 @@ export default function sum(Table,precision=2) {
}

})
sumdata[column.dataIndex] = DicimalFormater(count,precision);
let sum = DicimalFormater(count,precision);
sumdata[column.dataIndex] = sum;
if(column.sumRender&&typeof column.sumRender =='function'){
sumdata[column.dataIndex] = column.sumRender(sum)
}

}
if(index == 0){
sumdata[column.dataIndex] = "合计 "+sumdata[column.dataIndex];
Expand Down

0 comments on commit 4c6f69f

Please sign in to comment.