Create checkbox in jqGrid

I am trying to create a checkbox inside jqgrid columns and using the code below

{ name: 'CanDo', width: 50, index: 'CanDo', edittype: 'checkbox', editoptions: { value: "True:False" }, formatter: "checkbox", formatoptions: { disabled: true} } 

The Json object returns either "True" or "False"

But the flag itself is not created in the grid. What is the problem?

Please, help.

Edit: using jquery.jqGrid.BasicOnly.min.js 4.1.2

 $("#pGrid").jqGrid({ datastr: '@Html.Raw(@Model.PList)', datatype: 'jsonstring', colNames: ['id','CanDo' ,'Name'], colModel: [ { name: 'id', hidden: true }, { name: 'CanDo', width: 50, index: 'CanDo',editable: true, edittype: 'checkbox', editoptions: { value: "True:False" }, formatter: "checkbox", formatoptions: { disabled: true}, { name: 'Name', width: 150 } ], pager: '#pager', rowNum: 100, height: "200", viewrecords: true, caption: '<span class="spanH2">Test Process</span>' }); 

Json

 {"total":1,"page":1,"records":2, "rows": [ {"id":"1","cell":["1","True","Callback"]}, {"id":"8","cell":["8","False","Complaint"]}]} 
+4
source share
1 answer

I believe that you are missing the editable:true option. Try the following:

 { name: 'CanDo', width: 50, index: 'CanDo', editable: true, edittype: 'checkbox', editoptions: { value: "True:False" }, formatter: "checkbox", formatoptions: { disabled: true} } 
+9
source

Source: https://habr.com/ru/post/1440047/


All Articles