0

I need to make a check-box uncheckable in JqGrid. I have made a custom formatter to call a function for onClick event of the checkobx.

return "<input type=\"checkbox\" " + bchk +" onClick=\"clickMe\" " + " value=\""+
       cval+"\" offval=\"no\" "+ds+ "/>";

This function gets called fine. Now I don't know how to stop the user from checking the unchecked check-box. What I am trying to say is the user should be able to un-check but should be able to check again.

Thanks, Abhi

Oleg
  • 220,925
  • 34
  • 403
  • 798
Abhi
  • 65
  • 1
  • 1
  • 3

1 Answers1

0

I recommend you to make unobtrusive style binding to the onClick event (see this and this answers for details. Inside of event handle you can use e.preventDefault(); to prevent default behavior of the chechbox click.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Thx for your reply Oleg,but I figured it out. I added the following code loadComplete : function(){ jQuery(".jqgrow td input").each(function(){ jQuery(this).click(function(){ $(this).attr('checked', false); }); }); } – Abhi Feb 24 '11 at 21:31