In a working jqGrid with subGrid how I can hide th

2019-03-31 05:35发布

问题:

I want hide it completely from the main grid too.

See image for more clarification.

Thanks in advance.

回答1:

The column which you need to hide has the name "subgrid". So to hide it you can use

$("#grid").jqGrid("hideCol", "subgrid");

If you need to implement interface for opening or closing subgrids you can call toggleSubGridRow method directly. For example the following callback will toggle subgrid on double-click on the main row:

ondblClickRow: function (rowid) {
    $(this).jqGrid("toggleSubGridRow", rowid);
}

See the corresponding demo here:

UPDATED: If you want to hide additionally the icon from the first column of subgrid you can use the option

subGridOptions: { openicon: "ui-helper-hidden" }

and add additional CSS style

.subgrid-cell .ui-helper-hidden { display: none}

See the updated demo:

UPDATED 2: To hide the column with the icon in the subgrid row you can just use

.subgrid-cell { display: none}

See the next demo: