views:

251

answers:

3

Problem: jqGrid with subgirds. I want to disable the expand/collapse functionality for some rows of the main grid.

A: 

Unfortunately there is no jqGrid API for this. You will have to wait until the grid is created and then, perhaps from the loadComplete event, you will need to manually loop over all rows and disable selected ones.

If you inspect the DOM elements that compose the grid you can probably figure out a way to remove / disable the expander for selected rows. Perhaps by using jQuery.remove.

Justin Ethier
A: 

Add this to the gridConfig

afterInsertRow: function(rowid, aData, rowelem) {
    // Remove the subgrid plus button except for rows that have exceptions
    if (CONDITION) {
        $('#' + rowid).children("td.sgcollapsed").unbind().html("");
    }
},
Frank
A: 

Thx Frank, it's really helpful!

Alex