Is it possible to remove the expand/collapse button from the jqGrid header?
Asked Answered
Y

3

35

I'm using the jqGrid available at http://www.trirand.com/jqgrid/jqgrid.html and I can't find a way to disable its expand/collapse button on the top right of the header. Anyone know if there's an option to do that?

I'd like to remove the thing circled in red: alt text

Yamada answered 6/1, 2010 at 18:30 Comment(0)
M
59

Yes, there is an option for this: hidegrid: false


From the jqGrid documentation wiki for Options:

hidegrid

boolean

Enables or disables the show/hide grid button, which appears on the right side of the Caption layer. Takes effect only if the caption property is not an empty string.

Malmsey answered 6/1, 2010 at 21:52 Comment(4)
Thanks Justin...must've overlooked it.Yamada
Don't worry about it, it took me awhile to find this one too :)Malmsey
Thanks for the answer, but to be totally accurate, it's not a colmodel option but an option. trirand.com/jqgridwiki/doku.php?id=wiki:options ;)Teriann
Good point, thanks for the catch! :) I just updated my answer.Malmsey
D
1

Use this code to colllapse all jqgrid on the page

elements = $('div.ui-jqgrid-bdiv');
elements.each(function() { $(this).css("display", "none"); });
elements = $('div.ui-jqgrid-hdiv');
elements.each(function() { $(this).css("display", "none"); });
$('#JQGrid_pager').hide();
$('#rs_mJQGrid').hide();
Decontrol answered 29/7, 2010 at 12:33 Comment(1)
That may work, but it is safer to use the option in case the underlying implementation were to change in a future release of jqGrid...Malmsey
C
0

If you want to disable the main grids toggle button then you can set

hidegrid: false

If you are trying to disable or hide the subgrids expand and collapse button then use this on loadcomplete

jQuery("#GridTeableID").jqGrid('hideCol', "subgrid");
Chemulpo answered 19/11, 2013 at 5:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.