How can I hide the jqgrid completely when no data returned?

前端 未结 10 1476
无人及你
无人及你 2020-12-05 07:18

I\'m having a heck of a time trying to only display my jqGrid when records are returned from my webservice. I don\'t want it to be collapsed to where you only see the capti

10条回答
  •  有刺的猬
    2020-12-05 08:17

    Try using this method to hide jqGrid:

    $("#someGridTableName").jqGrid("GridUnload");
    

    Be sure to include:
    jquery.jqGrid-x.x.x/src/grid.custom.js file.

    See this post that talks more about the above method. Or jqGrid wiki where it talks about this method in the Add on Grid Methods section.

    Another point to consider:
    Avoid using wrapper (see post)

    tags on jqGrid to hide it because it's overflow: auto; attribute will not work if you try to make grid columns manually wider and exceed wrapper div's width.
    Another words, jqGrid is already equipped with logic to create horizontal scrollbar without help of external divs.

    Note: Tested on IE8 & 9

提交回复
热议问题