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

前端 未结 10 1503
无人及你
无人及你 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

    just a little twist on seth's solution:

    1. you can use in place of var recs = $('#list').jqGrid('getGridParam','records');

      var recs = $('#list').jqGrid('getGridParam','reccount');

      jqGrid grid option 'records' default value = 'None'

      jqGrid grid option 'reccount' defaults to 0 and will always return a number even when there are no records (returns 0)

      see wiki:options @ jqGrid Wiki

    2. If you don't want to use a wrapping div you can hide the whole jqGrid using $('.ui-jqgrid').hide() or $('.ui-jqgrid').show().

      The ui-jqgrid class is only used for the jqGrid parent.

提交回复
热议问题