jqGrid - supply no data message in the grid?

前端 未结 3 658
粉色の甜心
粉色の甜心 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:53

    To Oleg: Yes you are right, since jqGrid shows the message only in the pager i.e. navGrid. So placing one

    after the jqGrid table is the best way to show the message.

    To Marcus: See the below approach of what I did in one of the project. I pasted the HTML snippet - and loadComplete implementation, where you have to trigger your logic to show the "No records to show" message.

    HTML:

      

    Java Script:

    loadComplete: function() {
      if (j$(this).getGridParam("records")==0) 
      {
        j$('div#pagination').hide();
        if (j$('div.noResultsDiv').hasClass('jstHidden'))
        {
          j$('div.noResultsDiv').removeClass('jstHidden');
        }
      }
      else
      {
        j$('div#pagination').show();
        if (j$('div.noResultsDiv').length>0)
        {
          j$('div.noResultsDiv').addClass('jstHidden');
        }
      }
    }
    

提交回复
热议问题