简体   繁体   English

选中或取消选中jqgrid中的复选框

[英]checkbox check or uncheck in jqgrid

I create the jqgrid with checkbox in a row like, 我用复选框连续创建带有复选框的jqgrid,

{
   name: 'Confirm', index: 'Confirm', width: 100, sortable: false,
   formatter: function (rownum, cellvalue, options, rowObject) {
              return "<input type='checkbox' id='check'  />";
               }
       },

my grid like, 我的网格像 在此处输入图片说明

I need to check or uncheck based on the last column value. 我需要根据最后一列的值进行检查或取消选中。

If the Value is Confirm means i need to check the checkbox. 如果值是Confirm,则意味着我需要选中该复选框。

If the last column value is Notconfirmed means i need to uncheck the checkbox 如果最后一列的值是Notconfirmed,则我需要取消选中该复选框

Note:I load the grid value get from JSON 注意:我加载从JSON获取的网格值

Try this: 尝试这个:

$('tr td:last-child').each(function(){
   if($(this).text()=="Confirmed")
     $(this).prev().find('input').prop('checked', true);
   else
     $(this).prev().find('input').prop('checked', false);
}); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM