2

How do I dynamically disable a jqGrid row?

I have a form with a checkbox and jqgrid, I would like to disable the rows in the grid according to the checkbox value, I have tried the following with no luck:

Note: jqgridtable_Add_Remove is the name of the column in the jqGrid.

 function disableCheckBox() {
                var list = jQuery("#jqgridtable").getDataIDs();
                for (var i = 0; i < list.length; i++) {
                    if (getEnabledCheckboxVal()) {
                        $('#jqgridtable_Add_Remove').attr('disabled', true);                      
                    } else {
                        $('#jqgridtable_Add_Remove').removeAttr('disabled', true);
                    }
                }
            }

function disableCheckBox() {
            var list = jQuery("#jqgridtable").getDataIDs();
            for (var i = 0; i < list.length; i++) {
                //var rowData = jQuery("#jqgridtable").getRowData(list[i]);
                if (getEnabledCheckboxVal()) {                   
                    $('#' + list[i] + ' > td:not(.jqgrid-rownum)').attr('disabled', 'disabled');

                } else {
                    $('#' + list[i] + ' > td:not(.jqgrid-rownum)').removeAttr('disabled', 'disabled');
                }
            }
        }

 function getEnabledCheckboxVal() {
            var chk = $('#Enabled').is(':checked');
            return chk;
        }
4

1 回答 1

1
('#jqgridtable.jqgrow input').attr("disabled", "disabled")

似乎成功了。

于 2013-04-29T21:28:58.760 回答