jqgrid后台传参数

JScript code // 获得当前postData选项的值

var postData = $("#proList").jqGrid("getGridParam", "postData"); // 将查询参数融入postData选项对象

$.extend(postData, [color=#FF0000]$("#searchVoForm").serializeArray()[/color]);

$("#proList").jqGrid('setGridParam',{search: true}).trigger("reloadGrid", [{page:1}]);

 

HTML code

< s:form id ="searchVoForm" >
< table id ="searchVoInfo" class ="form_table" width ="100%" border ="1" cellpadding ="0" cellspacing ="0" >
< tr >
< td class ="td_title_right" width ="10%" >< s:label value ="项目名称 " /></ td >
< td width ="40%" align ="left" > < s:textfield id ="proName" name ="searchVo.proName" size ="30" maxlength ="50" cssStyle ="width:155px" /> </ td >
< td class ="td_title_right" width ="10%" >< s:label value ="建设地区" /></ td >
< td width ="40%" align ="left" > < s:textfield id ="buildArea" name ="searchVo.buildArea" size ="30" maxlength ="50" cssStyle ="width:155px" /> </ td >
</ tr >
</ table >
</ s:form >
< div style ="padding: 4px 0px 4px 0px; text-align: center;" >
< div id ="searchId" onclick ="searchProList();" > 查询 </ div >
< div id ="clearId" onclick ="clearParam();" > 清空 </ div > </ div >
< div id ="proGrid" class ="ui-layout-west ui-widget ui-widget-content" > < table id ="proList" width ="100%" ></ table > < div id ="pager" style ="width: 100%;" ></ div > </ div >
 
$("#list").setGridParam({postData:{"param1": "value1","param2": param2}}).trigger("reloadGrid");
假设jqgrid的id是list主要是改变postData的数据就行 更简单的是对象化form中所以要提交的控件
$.fn.serializeObject = function(){ 
 var o = {}; var a = this.serializeArray(); 
 $.each(a, function() {  
  if (o[this.name] !== undefined)
   {   
   if (!o[this.name].push)
    {    
    o[this.name] = [o[this.name]];   
    }   
    o[this.name].push(this.value || '');  
    } else {   
     o[this.name] = this.value || '';  
    } 
   }); 
    return o;};
然后var serialformdate = $("form").serializeObject()$("#list").setGridParam({page:1, postData:serialformdate}).trigger("reloadGrid");
提交所以form的数据导control了
 
 
 
 
 

 

转载于:https://www.cnblogs.com/wshsdlau/archive/2013/01/20/2868798.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值