jqGrid - supply no data message in the grid?

前端 未结 3 664
粉色の甜心
粉色の甜心 2021-01-21 18:09

If there was no data returned from our search currently we use the loadComplete callback to print out a message to the user to indicate that there is no data. Is th

3条回答
  •  迷失自我
    2021-01-21 18:42

    You can overwrite the body table html to show your message. Use this to do it:

    loadComplete: function() {
                    if ($('#Grid').getGridParam('records') === 0) {
                        oldGrid = $('#GridIdb2 tbody').html();
                        $('#Grid tbody').html("
    No records found
    "); } else oldGrid = ""; }

    Use the oldGrid var as an auxiliar to save what the jqgrid had before you changed; before submit a new search set the old value:

    if(oldGrid!=""){
        $("#Grid tbody").html(oldGrid);
    }
    

提交回复
热议问题