Jquery plugins jqGrid将行数据返回为字符串
我有jqGrid的本地数据,我为布尔列定制了格式化程序。差不多Jquery plugins jqGrid将行数据返回为字符串,jquery-plugins,jqgrid,jqgrid-formatter,Jquery Plugins,Jqgrid,Jqgrid Formatter,我有jqGrid的本地数据,我为布尔列定制了格式化程序。差不多 var boolFormatter = function (cellvalue, opt, rowObj) { if (cellvalue == null) return ""; return (cellvalue == true) ? return "Yes" : return "No"; } 我的模特喜欢 var colmodel = [ {index: id, name: id, hidden: t
var boolFormatter = function (cellvalue, opt, rowObj) {
if (cellvalue == null) return "";
return (cellvalue == true)
? return "Yes"
: return "No";
}
我的模特喜欢
var colmodel = [
{index: id, name: id, hidden: true}
{index: someProperty, name: someProperty, formatter: boolFormatter}
]
问题是当我调用对象的rowData时,我得到了字符串值,即
var rowData = grid.getRowData(1);
var value = rowData["someProperty"];
在函数boolFormatter中,当cellvalue==null时返回值,返回值返回Yes
:当cellvalue==true时返回否。这就是为什么会有字符串值
用下面的代码更新你的代码
var boolFormatter = function (cellvalue, opt, rowObj) {
if (cellvalue == null) {
return null;
} else {
return (cellvalue == true) ? return true : return false;
}
}