diff --git a/examples/table.html b/examples/table.html
index 5281bc22..5b847ec6 100644
--- a/examples/table.html
+++ b/examples/table.html
@@ -302,7 +302,8 @@ layui.use(['table', 'dropdown'], function(){
,{field: 'sign', title: '签名', width: 150}
,{field: 'sex', title: '性别', width: 80}
,{field: 'city', title: '城市', width: 100}
- ,{field: 'experience', title: '积分', width: 80, sort: true}
+ // ,{field: 'experience', title: '积分', width: 80, sort: true}
+ ,{field: 'experience', title: '积分', width: 80, sort: true, totalRow: true, totalRowDecimalScale: 20}
]]
,data: [{
"id": "10001"
@@ -402,6 +403,7 @@ layui.use(['table', 'dropdown'], function(){
,page: true //是否显示分页
,limits: [3,5,10]
,limit: 3 //每页默认显示的数量
+ ,totalRow: true
//,loading: false //请求数据时,是否显示loading
});
diff --git a/src/modules/table.js b/src/modules/table.js
index 32f2ae52..6a3db8a1 100644
--- a/src/modules/table.js
+++ b/src/modules/table.js
@@ -991,8 +991,13 @@ layui.define(['laytpl', 'laypage', 'layer', 'form', 'util'], function(exports){
//td 内容
var content = function(){
+ if( item3.totalRowDecimalScale == null || isNaN(item3.totalRowDecimalScale) ||
+ item3.totalRowDecimalScale < 0 || item3.totalRowDecimalScale > 10 ){
+ // 如果检测到非法值就重设为2。至于非法值的定义这里是我自己定义的。
+ item3.totalRowDecimalScale = 2;
+ }
var text = item3.totalRowText || ''
- ,thisTotalNum = parseFloat(totalNums[field]).toFixed(2)
+ ,thisTotalNum = parseFloat(totalNums[field]).toFixed(item3.totalRowDecimalScale)
,tplData = {}
,getContent;