开发者

hide column (header and rows) post jqGrid render

Is it possible to hide a specific column in jqGrid after it has been setup, while ensuring all alignments are correct (table width and header/data alignment) for IE/FF.

The data can't be removed at back-end w/o major refactoring.

I am reiterating through a specif开发者_运维百科ic column and checking if it is all empty, and if so, I tried .remove() on the header and cells for that column, but the alignment goes off seriously (I think setGridWidth is still taking into account that removed column's width). I know there is a hide option when jqGrid initialises... but not sure if there is a method for that post render.


You can use the hideCol and showCol methods for hiding and showing columns after the jqGrid is created. The method hideCol doesn't remove any of the data from the jqGrid but only hides the specified column. See http://www.trirand.com/jqgridwiki/doku.php?id=wiki:methods for details.

I recommend examining the loadComplete event. You can get IDs of the loaded data using the getDataIDs method, then get the row data in a loop using getRowData. Make sure to check for empty data. Don't forget to call showCol for all columns you previously hid. You can always call showCol for all columns that should be seen and call hideCol for all columns you want to hide.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜