使用jquery的自定义列复选框格式化程序

时间:2017-03-15 04:33:17

标签: javascript jquery checkbox datagridviewcheckboxcell checkboxpreference

我必须在其中一列(中间列)添加复选框..我应该使一些行不可编辑复选框..我需要知道的是我如何实现标题的选择所有选项..它&# 39;没有出现在网格中..我已经设置了多选:真实

columnDisplay = [{"name":"columnId",
                    "label":"Column Id",
                    "type":"string" ,
                     hidden:true,
                     "width":"200",
                     key:true
                  },
                  {
                   "name":"columnDisplayName",
                   "label":"Column Display Name",
                   "type":"string" ,
                   "visibility":true, 
                   "width":"200"
                   },

                   {
                   "name":"visibility", 
                   "label":"Visibility",
                   "editable": true, 
                   "width":"200",
                   "edittype": "checkbox",
                   "editoptions": { value:"Y:N" }, 
                   "formatter": "checkbox", 
                   "formatoptions": { disabled: false}
        }];


createjqGrid : function (gridId , column , gridData){
                $("#" + gridId).jqGrid({
                        datatype: 'local',
                        data: gridData,
                        editurl: 'clientArray',
                        colModel: columns,
                        loadonce: false,
                        autowidth: true,
                        shrinkToFit: false,
                        rownumbers: true,
                        multiselect: multiSelect,
                        multiboxonly:true,
                        cellEdit: false,
                        toppager: true,
                        cloneToTop: true,
                        gridview:true,
                        rowNum: 100,
                        viewrecords : true,
                        pager: "#pager" + gridId,
                        viewsortcols: viewSort,
                        cellsubmit: 'clientArray'
                    });
                }

请帮忙!!提前致谢 。可见性列我必须使其具有复选框..它适用于列但在标题中我必须添加.. enter image description here

1 个答案:

答案 0 :(得分:0)

发现

                      "name":"visibility", 
                       "label":"<input role='checkbox' type='checkbox' id='grid'>Visibility",
                       "editable": true, 
                       "width":"200",
                       "edittype": "checkbox",
                       "editoptions": { value:"Y:N" }, 
                       "formatter": "checkbox", 
                       "formatoptions": { disabled: false}

我们需要设置角色并且类型是复选框..所以标题会获得复选框