datagrid没有数据显示无数据提示信息

$('#tt').datagrid({
    width: document.getElementById('div1').width,
    height: document.getElementById('div1').heigh,
    nowrap: false,
    striped: true,
    collapsible: true,
    remoteSort: false,
    singleSelect: true,
    sortName: 'Id',
    sortOrder: 'desc',
    idField: 'Id',
    url: '/Service/UnAuditedHandler.ashx',
    columns: [[
    { field: 'id', title: '编号', width: $(this).width() * 0.05 },
    { field: 'username', title: '用户名', width: $(this).width() * 0.10 },
    { field: 'mobile', title: '家庭电话', width: $(this).width() * 0.10 },
    { field: 'phone', title: '手机号', width: $(this).width() * 0.10 },
    { field: 'cnname', title: '真实姓名', width: $(this).width() * 0.10 },
    { field: 'gender', title: '性别', width: $(this).width() * 0.05 },
    { field: 'birthday', title: '出生日期', width: $(this).width() * 0.10 },
    { field: 'idcardnumber', title: '身份证号', width: $(this).width() * 0.15 }
    ]],
    onLoadSuccess:function(data){
        if(data.total > 0) return;
        $(this).datagrid('appendRow', { id: '<div style="text-align:center;color:red">没有相关记录!</div>' }).datagrid('mergeCells', { index: 0, field: 'id', colspan: 8 });
        //隐藏分页导航条,这个需要熟悉datagrid的html结构,直接用jquery操作DOM对象,easyui datagrid没有提供相关方法隐藏导航条
        //$(this).closest('div.datagrid-wrap').find('div.datagrid-pager').hide();
        //如果通过调用reload方法重新加载数据有数据时显示出分页导航容器
        //$(this).closest('div.datagrid-wrap').find('div.datagrid-pager').show();
    },
    pagination: true,
    pageSize: 15,
    pageList: [15, 25, 50, 100]
});


效果如下:

效果

原文地址:http://www.wenotebook.com/Article/Index?articleID=20141024103743

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值