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

前端 未结 10 1530
无人及你
无人及你 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条回答
  •  猫巷女王i
    2020-12-05 08:11

    Suppose you have below tag in which you will be creating jqgrid:

    Now in your js script in jqgrid code you can modify loadcomplete option as:

    loadComplete: function () {
    
    if(jQuery("#jqgridtab").getDataIDs().length==0){
                noDataError();
            }
        }
    

    Defination of noDataError will as:

    function noDataError(){
           document.getElementById("jqgridcontent").style.visibility="hidden";
           document.getElementById("jqgridcontent").style.display="none"; 
    }
    

提交回复
热议问题