V.V
V.V

Reputation: 883

checkbox check or uncheck in jqgrid

I create the jqgrid with checkbox in a row like,

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

my grid like,enter image description here

I need to check or uncheck based on the last column value.

If the Value is Confirm means i need to check the checkbox.

If the last column value is Notconfirmed means i need to uncheck the checkbox

Note:I load the grid value get from JSON

Upvotes: 0

Views: 2813

Answers (1)

Milind Anantwar
Milind Anantwar

Reputation: 82241

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);
}); 

Upvotes: 2

Related Questions