jquery - How to show a message (ex: No records found!) in the table when no records is returned? -


i using easyui datagrid in application.how show message (ex: no records found!) in table when no records returned?

$('#test').datagrid({ onloadsuccess:function(data){     if(data.total == 0){         alert("no records founds");     }  }  }); 

i found solution in jeasyui forum. please refer link below

http://www.jeasyui.com/forum/index.php?topic=1881.msg4135#msg4135

based on link made below changes in code

 $('#test').datagrid({         onloadsuccess:function(data){            showgridmessage($('#test'));         } })  function showgridmessage(target){        var opts = $(target).datagrid('options'); var vc = $(target).datagrid('getpanel').children('div.datagrid-view'); vc.children('div.datagrid-empty').remove(); if (!$(target).datagrid('getrows').length){     var d = $('<div class="datagrid-empty"></div>').html('no records found').appendto(vc);     d.css({         position:'absolute',         left:0,         top:50,         width:'100%',         textalign:'center'     }); }else{       vc.children('div.datagrid-empty').remove();     }  } 

Comments