码迷,mamicode.com
首页 > Web开发 > 详细

Jquery-easyUI-datagrid参数之 queryParams

时间:2015-09-12 22:20:48      阅读:342      评论:0      收藏:0      [点我收藏+]

标签:

http://blog.163.com/xpf_designer/blog/static/19213618920117784055668/

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:‘任免批次编号‘,width:200,sortable:true},

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

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

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

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

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

              {field:‘memo‘,title:‘备注‘,width: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‘); 

        

    }

Jquery-easyUI-datagrid参数之 queryParams

标签:

原文地址:http://www.cnblogs.com/zkwarrior/p/4803700.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!