jqGrid with an editable checkbox column

后端 未结 6 2289
难免孤独
难免孤独 2020-12-23 20:41

When using jqGrid how do you force a cell to load in its editable view on page load as well as when it is clicked?

If you set up \'cell editing\' like below, the che

6条回答
  •  不思量自难忘°
    2020-12-23 21:04

    To allow the checkboxes to always be click-able, use the checkbox formatter's disabled property:

    { name: 'MyCol', index: 'MyCol', 
      editable:true, edittype:'checkbox', editoptions: { value:"True:False"}, 
      formatter: "checkbox", formatoptions: {disabled : false} , ...
    

    To answer your second question, you will have to setup an event handler for the checkboxes, such that when one is clicked a function is called to, for example, send an AJAX POST to the server. Here is some example code to get you started. You can add this to the loadComplete event:

        // Assuming check box is your only input field:
        jQuery(".jqgrow td input").each(function(){
            jQuery(this).click(function(){
                // POST your data here...
            });
        });
    

提交回复
热议问题