3

I want hide it completely from the main grid too.

See image for more clarification.

Thanks in advance.enter image description here

Charles
  • 50,943
  • 13
  • 104
  • 142
Diosney
  • 10,520
  • 15
  • 66
  • 111

1 Answers1

8

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

Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Hi Oleg! I hoped so much that you will be online to answer me :D Thanks!! It worked in the main grid like a charm but I'm not been able to make this work in the subgrid, can you help me a little more? :D Thanks in advance! – Diosney Sep 15 '12 at 16:55
  • The thing is that I want remove the subgrid icon column too. The only way I managed to do that is through `.subgrid-cell->display:none`, but then it shifts subgrid to the left one column (great! desired effect) but leaves a blank column at the right of subgrid (undesired effect). Instead of that black column I need that the subgrid expands and takes the whole width. Thanks again for the troubles :D – Diosney Sep 15 '12 at 17:07
  • Thanks :) I think that I will let the subgrid as you shown in the second example, I still want to shift the subgrid one column to the left but that is fine :D Thanks again. – Diosney Sep 15 '12 at 17:27
  • 1
    @diosney: If you need to hide the column with the icon you can just use CSS `.subgrid-cell { display: none}`: see [the demo](http://www.ok-soft-gmbh.com/jqGrid/subgridtoggleondoubleclick2.htm) – Oleg Sep 15 '12 at 17:33
  • Heyy! What you did in the last example is EXACTLY what I need! Thanks! I will check it and I will tell you later :D – Diosney Sep 16 '12 at 20:09
  • Sorry, right now it is when I realizzed that I don't tell you an important data and it is that I'm using a Grid as a Subgrid. Can you show me an example? – Diosney Sep 17 '12 at 02:49
  • @diosney: Sorry, but I am now in the business trip in another country. So I can't make more demos for you. I think that all what I posted should work also with Grid as a Subgrid. Which problem you have currently? – Oleg Sep 17 '12 at 09:34
  • Oh! Sorry then :) It keep me showing a blank column at the right os the subgrid. – Diosney Sep 17 '12 at 15:34
  • @diosney: I am not sure what is your problem. Look at [the demo](http://www.ok-soft-gmbh.com/jqGrid/subgridswithdisabled.htm). Everything seems be OK. Probably you should increase the width of the column in the subgrid to have no free space? – Oleg Sep 17 '12 at 19:51
  • Thanks, settings a width and autowidth=false solved my issue :D Thanks again :D – Diosney Sep 22 '12 at 19:18