jqGrid 和 jqPivot:如何用输入标签替换数据透视列的值?

jqGrid and jqPivot: How to replace value of pivot column by input tag?

我将 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,则选中 return 复选框,如果值 = 0,则 return 复选框

有什么办法吗?

如果您在模板中设置空字符串,此代码将起作用。请查看免费的 jqGrid 文档什么是模板以及参数可以接受的可能值

                aggregates: [
                    { member: "KindOfCare",
                    template: "",
                      aggregator: function (options) {
                        //console.log(options);
                        //return options.item.value;
                        if(options.item.value == 1){
                          return '<input class="center" type="checkbox" checked disabled />';
                        }
                        else{
                          return '<input class="center" type="checkbox" disabled />';

                        }
                      } 

                    }
                ]