• easyui treegrid 分页


    $(function () {

    $('#maintable').treegrid({

    '98%',
    height: 550,
    nowrap: true,
    striped: true,
    fit: true,
    url: '/Module/getModuleList',
    idField: 'MENU_ID',
    fitColumns: false,
    queryParams: {
    Modulename: $("#txtModuleName").textbox('getValue'),
    AppID: $("#txtSystem").combobox('getValue'),
    isHide: $("#isHide").combobox('getValue')
    },

    columns: [[
    { field: 'ck', checkbox: true },
    { field: 'MENU_ID', title: '模块编号', 150, align: 'left',hidden:'true' },
    {
    field: 'MENU_NAME', title: '模块名称', 250, align: 'left'
    },
    {
    field: 'NAV_URL', title: '地址', 250, align: 'left'
    },
    {
    field: 'IS_HIDE', title: '是否隐藏', 100, align: 'left'
    },
    {
    field: 'SHOW_ORDER', title: '排序', 100, align: 'left'
    }
    ]],
    onBeforeLoad: function(row,param){
    if (!row) { // load top level rows
    param.id = 0; // set id=0, indicate to load new page rows
    }

    else {

    $(this).treegrid('options').url = '/Module/getModuleList?page=1&rows=999&id=' + row.MENU_ID;//打开父节点,防止孩子过多而不显示
    }


    },
    treeField: 'MENU_NAME',
    pagination: true,
    rownumbers: true,
    pageNumber: 1, 

    pagePosition: 'buttom'

    });

    //设置分页控件 
    var p = $('#maintable').datagrid('getPager');
    $(p).pagination({
    pageSize: 10,//每页显示的记录条数,默认为10 
    pageList: [5, 10, 25],//可以设置每页记录条数的列表 
    beforePageText: '第',//页数文本框前显示的汉字 
    afterPageText: '页    共 {pages} 页',
    displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'

    });

    });

    <div class="panel " style="padding: 0 10px; height: 520px;">
    <table id="maintable" class="easyui-treegrid"></table>
    </div>

    后台代码:

    public string getModuleList()
    {
    //获取Request信息
    int intPageSize = int.Parse(Request["rows"].ToString());//每页展示行数
    int intCurrentPage = int.Parse(Request["page"].ToString());//当前页
    string strIsHide = Request["isHide"].ToString();
    string strAppID = Request["AppID"].ToString();
    string strModuleName = Request["Modulename"].ToString();
    string strMenuID = Request["id"].ToString();//父节点值,参数只能为id,不能为其他名称

    //总记录数
    int totalcount = 0;
    //分页获取用户列表
    DataTable dt = moduleBll.GetListByPage(intPageSize, intCurrentPage, out totalcount, strModuleName, strIsHide, strAppID, strMenuID);
    string strResult = easybll.getModuleList(dt, totalcount);
    return strResult;
    }

  • 相关阅读:
    剑指offer-删除链表中重复的节点
    剑指offer——二叉树中和为某一值的路径
    动态规划之140 Word Break2
    动态规划之139 Word Break
    动态规划之132 Palindrome Partitioning II
    动态规划之115 Distinct Subsequences
    动态规划之97 Interleaving String
    动态规划之91 decode ways
    vector
    第一篇
  • 原文地址:https://www.cnblogs.com/flyrain/p/treegrid_page.html
Copyright © 2020-2023  润新知