【发布时间】:2018-03-14 12:25:09
【问题描述】:
我想将数字格式化程序设置为 colModel,我以对象的形式向其传递一个值,例如需要将数字格式化程序设置为最多 2 个小数点。我添加了引用文档的格式化程序,但无法设置 colmodel 属性
colModel: $scope.colModelValue
示例代码如下:
function drawGrid() {
$("#grid").jqGrid("GridUnload");
var grid = $("#grid"),lastSel;
jQuery("#grid").jqGrid({
formatter : {
number : {decimalSeparator:".", thousandsSeparator: " ", decimalPlaces: 2, defaultValue: '0.00'}},
sortable: true,
datatype: "local",
data: $scope.jqGridData,
colNames: $scope.jqgridColHeader,
colModel: $scope.colModelValue,
viewrecords: true,
caption: "Peer Analysis",
rowNum:10,
rowList:[10,20,30],
recordpos: 'left',
footerrow : true,
userDataOnFooter : true,
restoreAfterSelect: false,
saveAfterSelect: true,
altRows : true,
multiselect: true,
cellEdit: true,
autowidth:true,
treeGrid: true,
grouping: true,
shrinkToFit: true,
pager: '#pager',
gridview: true,
'cellEdit': true,
'cellsubmit' : 'clientArray',
editurl: 'clientArray',
【问题讨论】:
-
使用的是哪个版本的jqGrid? Guriddo jqGrid、free-jqGrid 或 jqGrid
-
我使用的是 jqGrid 4.6 版本