• datagrid参数queryParams--easyUI


     

    datagrid参数queryParams--easyUI

    Html

             <div  region="center" border="false"  style="padding:0px 3px 0px 3px;margin:0px;"> 

                  <table id="test"></table> 

        </div>

    初置化gird

    $(function(){ 

                       

                      loadgrid();    

                      //loadcombobox(null); 

           });

    function loadgrid(){

           $('#test').datagrid({

                  title:'任免信息列表',

                  fit:true,

                  nowrap: false,

                  striped:false,

                  //url:'rm.json',

                  url:'http://127.0.0.1:8080/web/AppAndRemoveServer.server',

                  queryParams:{},

                  sortName: 'appandremove_id',

                  sortOrder: 'asc',

                  remoteSort: false,

                  idField:'appandremove_id',

                  frozenColumns:[[

                        {field:'ck',checkbox:true}

                  ]],

                  columns:[[{field:'appandremove_id',title:'任免批次编号',200,sortable:true},

                  {field:'batch_name',title:'任免批次名称',240,sortable:true},

                  {field:'batch_no',title:'任免批次编号',100,sortable:true},

                  {field:'recorder_date',title:'登记时间',120,sortable:true},

                  {field:'recorder_id',title:'登记人',100,sortable:true},

                  {field:'state',title:'状态',100,sortable:true},

                  {field:'memo',title:'备注',300}

              

                  ]],

                  pagination:true,

                  pageNumber:1,

                  pageSize:5,

                  pageList:[5,10],           

                  //singleSelect:true,

                  rownumbers:true  

               });

        }

    服务端接收rows、page、order、sort参数

        参数名称是easyui起的,值也是自动绑定

        可以在服务端通过request.getParameterNames();查看有什么参数

        接收参数值

        if(null!=request.getParameter("rows")) {             pageRows=Integer.parseInt(request.getParameter("rows").toString());  

           }  

           if(null!=request.getParameter("page")) {  

               page=Integer.parseInt(request.getParameter("page").toString());  

           } 

           if(null!=request.getParameter("order")) {  

               order=request.getParameter("order").toString();  

           }

           if(null!=request.getParameter("sort")) {  

               order=request.getParameter("sort").toString();  

             }

        然后拼装sql语句实现分页。

     增加查询参数,重新加载表格

    function reloadgrid (stateVal)  {  

           //查询参数直接添加在url中         

           /* var url =$('#test').datagrid('options').url;

            url = "http://127.0.0.1:8080/web/AppAndRemoveServer.server?state=" +stateVal;   

    //重新赋值url 属性

            $('#test').datagrid('options').url=url;

            $("#test").datagrid('reload'); 

            */

            

            //查询参数直接添加在queryParams中    

            var queryParams = $('#test').datagrid('options').queryParams;  

             queryParams.state = stateVal;  

             $('#test').datagrid('options').queryParams=queryParams;        

             $("#test").datagrid('reload'); 

            

        }

    by archie
  • 相关阅读:
    关于分区索引对齐
    SQLSERVER 分区表实战
    鱼骨图实践
    Python之路-python(面向对象一)
    Python之路-python(常用模块学习)
    Python之路-python(装饰器、生成器、迭代器、Json & pickle 数据序列化、软件目录结构规范)
    Python之路-python(set集合、文本操作、字符编码 )
    Python之路-python数据类型(列表、字典、字符串、元祖)操作
    Python之路-python环境安装和简单的语法使用
    javascript中with语句应用
  • 原文地址:https://www.cnblogs.com/jiangsheng3/p/4988963.html
Copyright © 2020-2023  润新知