In a working jqGrid with subGrid how I can hide th

2019-03-31 05:40发布

I want hide it completely from the main grid too.

See image for more clarification.

Thanks in advance.enter image description here

1条回答
【Aperson】
2楼-- · 2019-03-31 06:28

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:

enter image description 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:

enter image description here

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:

enter image description here

查看更多
登录 后发表回答