1 var myview = $.extend({},$.fn.datagrid.defaults.view,{ 2 onAfterRender:function(target){ 3 $.fn.datagrid.defaults.view.onAfterRender.call(this,target); 4 var opts = $(target).datagrid('options'); 5 var vc = $(target).datagrid('getPanel').children('div.datagrid-view'); 6 vc.children('div.datagrid-empty').remove(); 7 if (!$(target).datagrid('getRows').length){ 8 var d = $('<div class="datagrid-empty"></div>').html(opts.emptyMsg || 'no records').appendTo(vc); 9 d.css({ 10 position:'absolute', 11 left:0, 12 top:50, 13 width:'100%', 14 textAlign:'center' 15 }); 16 } 17 } 18 });
1 $('#dg').datagrid({ 2 view: myview, 3 emptyMsg: 'no records found' 4 });