zoukankan      html  css  js  c++  java
  • easy ui datagrid在没有数据时显示相关提示内容

    $(function () {
        $('#dg').datagrid({
            fitColumns: true,
            url: 'product.json',
            pagination: true,
            pageSize: 3,
            onLoadSuccess: function (data) {
                if (data.total == 0) {
                    //添加一个新数据行,第一列的值为你需要的提示信息,然后将其他列合并到第一列来,注意修改colspan参数为你columns配置的总列数
                    $(this).datagrid('appendRow', { itemid: '<div style="text-align:center;color:red">没有相关记录!</div>' }).datagrid('mergeCells', { index: 0, field: 'itemid', colspan: 4 })
                    //隐藏分页导航条,这个需要熟悉datagrid的html结构,直接用jquery操作DOM对象,easyui datagrid没有提供相关方法隐藏导航条
                    $(this).closest('div.datagrid-wrap').find('div.datagrid-pager').hide();
                }
                //如果通过调用reload方法重新加载数据有数据时显示出分页导航容器
                else $(this).closest('div.datagrid-wrap').find('div.datagrid-pager').show();
            },
            title: 'easyui datagrid没有数据显示无数据提示信息',
             550,
            columns: [[{ field: 'itemid',  80, title: 'Item ID' },
             { field: 'productname',  100, editor: 'text', title: 'Product Name' },
             { field: 'listprice',  80, align: 'right', title: 'List Pirce' },
             { field: 'unitcost',  80, align: 'right', title: 'Unit Cost'}]]
        });
    });

    文章出处:http://www.cnblogs.com/huyong/p/4896958.html

  • 相关阅读:
    MySQL之ORM
    MySQL之索引补充
    MySQL存储过程
    c primer plus 7编程练习
    c语言中统计单词数目程序
    c语言统计输入字符数及行数
    c语言中getchar()、putchar()函数例子
    c primer plus 6编程练习
    c语言 %c 一次输出多个字符 (特殊程序)
    c语言 复合赋值运算符的优先级低于算术运算符
  • 原文地址:https://www.cnblogs.com/foreverfendou/p/5091511.html
Copyright © 2011-2022 走看看