2012-06-17 82 views
0

我正在使用jqgrid,并且对复选框有问题。Jqgrid和复选框

我在我的数据库中有一列返回'S' --> true'N'--> false

我在网上看到过一些例子,我选择了这条路(认为是正确的):

{name:'acc_web', index:'acc_web', width:60, editable:true, edittype:"checkbox", formatter:"checkbox",editoptions: {value:"S:N"}}, 

然而,这总是检查作为true的复选框。这里有什么不对吗?此外,我已经把它作为editable,但我不能!

整个代码是这样的:

$(document).ready(function() { 

    jQuery("#list2").jqGrid({ 
     url:'obtieneUsuarios.do', 
     datatype: "json", 
     colNames:['Acceso web','Primer apellido','Segundo apellido','Nombre','Login', 'Perfil'], 
     colModel:[ 
      {name:'acc_web', index:'acc_web', width:60, editable:true, edittype:"checkbox", formatter:"checkbox",editoptions: {value:"S:N"}},    
      {name:'apellido1',index:'apellido1', width:200}, 
      {name:'apellido2',index:'apellido2', width:200}, 
      {name:'nombre',index:'nombre', width:160},    
      {name:'login',index:'login', width:100}, 
      {name:'perfil',index:'perfil', width:160} 
     ], 
     width: 820, 
     height: 200, 
     rowNum:10, 
     rowList:[5,10,20], 
     pager: '#pager2', 
     sortname: 'apellido1', 
     viewrecords: true, 
     sortorder: "asc", 
     caption:"Listado de usuarios" 
    }); 
    jQuery("#list2").jqGrid('navGrid','#pager2',{edit:false,add:false,del:false}); 
}); 

回答

0

(通过在一个问题编辑OP回答转换为一个社区维基答案见Question with no answers, but issue solved in the comments (or extended in chat)。)

的OP写道:

最后我解决了这个问题:

复选框jqgrid识别只有一些属性为false,0,No,undefined等等。我只需将我的结果映射到这些结果。在这种情况下:'S' --> 1'N' --> 0。有了这个映射,问题就解决了:)