扩展当easyui datagrid无数据时,显示特定值。如:没有数据

 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 });

转自:http://www.jeasyui.com/forum/index.php?topic=1881.0

posted @ 2013-11-30 17:37  少爵  阅读(8610)  评论(0编辑  收藏  举报