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

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

    jqGrid wraps your table with it's special sauce and divs so you should be able to do what you want by wrapping that table with your own div that you can hide:

     

    Then in your gridComplete:

       gridComplete: function() {
            var recs = parseInt($("#list").getGridParam("records"),10);
            if (isNaN(recs) || recs == 0) {
                $("#gridWrapper").hide();
            }
            else {
                $('#gridWrapper').show();
                alert('records > 0');
            }
        }
    

    Hope this helps.

提交回复
热议问题