【发布时间】:2017-12-22 08:25:14
【问题描述】:
我将 jqGrid 与 jqPivot 一起使用。
我的数据:
var data = [{
Account: "Tom", Contact: "Mary", KindOfCare: 'Birthday', value: 1, notes: 'Birthday'
}, {
Account: "Tom", Contact: "Mary", KindOfCare: 'Christmas', value: 0, notes: 'Birthday'
}, {
Account: "Tom", Contact: "Mary", KindOfCare: 'New Year', value: 0, notes: 'Birthday'
}, {
Account: "Tom", Contact: "Mia", KindOfCare: 'Birthday', value: 0, notes: 'Birthday'
}, {
Account: "Tom", Contact: "Mia", KindOfCare: 'Christmas', value: 0, notes: 'Birthday'
}, {
Account: "Tom", Contact: "Mia", KindOfCare: 'New Year', value: 0, notes: 'Birthday'
},
{
Account: "Anna", Contact: "David", KindOfCare: 'Birthday', value: 1, notes: 'Birthday'
}, {
Account: "Anna", Contact: "David", KindOfCare: 'Christmas', value: 1, notes: 'Birthday'
}, {
Account: "Anna", Contact: "David", KindOfCare: 'New Year', value: 0, notes: 'Birthday'
}, {
Account: "Selena", Contact: "Bieber", KindOfCare: 'Birthday', value: 0, notes: 'Birthday'
}, {
Account: "Selena", Contact: "Bieber", KindOfCare: 'Christmas', value: 1, notes: 'Birthday'
}, {
Account: "Selena", Contact: "Bieber", KindOfCare: 'New Year', value: 1, notes: 'Birthday'
}];
我想用输入标签替换数据透视列的值,例如:如果值 = 1,则返回复选框选中,如果值 = 0,则返回复选框
有什么办法吗?
【问题讨论】:
-
我在这里:plnkr.co/edit/WfRtXnUk9KqarOfdp63L?p=preview。我尝试返回 '' 但不工作,结果返回 NaN
-
您的数据透视设置是从另一个代码复制/粘贴,与您的实际数据没有任何关系。为了帮助您需要根据您的数据进行设置
-
@TonyTomov,我更新了我的 plunk,请再试一次
-
@TonyTomov,你能不能用复选框 checked 替换 1,用复选框 not checked 替换 0
-
由于您使用 free-jqGrid 我无法告诉您传递给函数的参数是什么 - 在 Guriddo jqGrid 中这很容易,您可以阅读docs 做什么,但在您可能不想将数据用作数字以便按照您的建议设置输入
标签: jquery jqgrid free-jqgrid jqpivot