easy UI 前端分页

来源:互联网 发布:淘宝店铺信誉 编辑:程序博客网 时间:2024/04/29 03:04
 <div region="center" class="positionR">             <table id="TemplateList"></table> </div>
$("#TemplateList").datagrid({            title: '报警模板列表',            iconCls: 'icon-save',//easy-ui一个包含图标的CSS类ID//            fit: true,            width: 'auto',            height: 'auto',            nowrap: false,//当为true时,显示数据在同一行上,默认为true            rownumbers: true,//当为true时,显示行号,默认为false            fitColumns: true,//True就会自动扩大或者缩小列的尺寸以适应表格的宽度并且防止水平滚动            animate: true,//当展开或折叠时是否定义动画效果            collapsible: true,//            pagination: true,//True就会在datagrid的底部显示分页栏            pageNumber: 1,//初始化页码            pageSize: 10,//初始化尺寸            //            url: '/Alarm/GetTemplateList?UserID=' + getCookie("UserID") + '&AreaID=' + getCookie("AreaID") + '&TemplateName=' + templateName2,            url: '/Alarm/GetTemplateListForPaging?UserID=' + getCookie("UserID") + '&AreaID=' + getCookie("AreaID") + '&TemplateName=' + templateName2 + '&page=' + 1 + '&rowCount=' + 10,            loadMsg: '正在加载数据,请稍候......',            columns: [[//                { field: 'UserID', width: 140, title: '用户ID', align: 'center',resizable:true },                { field: 'TemplateName', width: 140, title: '报警模版名称', align: 'center' },                { field: 'AreaName', width: 140, title: '报警区域', align: 'center' },                { field: 'LevelName', width: 140, title: '报警级别名称', align: 'center' },                { field: 'TypeName', width: 140, title: '报警类型名称', align: 'center' },                { field: 'Description', width: 300, title: '备注说明', align: 'center' },                { field: 'ID', width: 140, title: '操作', align: 'center', formatter: function (value) {                    return '<a href=\"#\" onclick=\"openEditTemplate(this,' + value + ');\">编辑</a>&nbsp;&nbsp;<a href=\"#\" onclick=\"deleteTemplate(' + value + ');\">删除</a>';                }                }              ]]        });        $('#table').resize(function () {            $("#TemplateList").datagrid("resize", { width: getWidth() });        });        function getWidth() {            return $("#table").width() * 0.99;        }        $("#TemplateList").datagrid('getPager').pagination({            displayMsg: '当前显示从{from}到{to} 共{total}条记录',            onSelectPage: function (pageNumber, pageSize) {                $("#TemplateList").datagrid('options').url = '/Alarm/GetTemplateListForPaging?UserID=' + getCookie("UserID") + '&AreaID=' + getCookie("AreaID") + '&TemplateName=' + templateName2 + '&page=' + 1 + '&rowCount=' + 10,                   $("#TemplateList").datagrid('reload');            }        });    });
0 0
原创粉丝点击