easyui datagrid 格式化列显示两位小数、千分位

 { field: "contractmoney", title: "合同总价", width: 72, formatter: function (value, row, index) {
                        if (row != null) {
                            return parseFloat(value).toFixed(2);
                        }
                    }
                    },

 

 //二位小数、千分位

 { field: "price", title: "单价", width: 60, align: 'right', formatter: function (value, row, index) {
                                if (row != null) {
                                    return (parseFloat(value).toFixed(2) + '').replace(/\d{1,3}(?=(\d{3})+(\.\d*)?$)/g, '$&,');
                              }
                              }
                            },

 

posted @ 2016-12-28 15:44  一枚水  阅读(14219)  评论(4编辑  收藏  举报