【发布时间】:2013-02-12 14:05:31
【问题描述】:
JqGrid 文档说明了有关 postData 的以下内容:
用于向发布到服务器的数据添加内容的数组
就是这样。因此,我使用 postData 将变量发送到我的 PHP,以便我可以使用 switch case 来调用我想要的函数。
这允许我拥有一个包含项目所有功能的 PHP 页面。我想对editData 做同样的事情,所以我不需要为与项目关联的每个内联编辑功能创建一个 PHP 页面。
但是,editData 似乎没有传递到 PHP 页面。我尝试将 POSTed 变量打印到文件中,但它们是空的。有什么建议吗?
注意:我知道editData 错误,但这应该已由我正在使用的版本 4.4.4 修复
$("#list").jqGrid({
url:'functions.php',
datatype:'xml',
mtype:'POST',
postData: {
action:'popGrid',
sqlCount:sqlCount,
sqlSelect:sqlSelect,
sqlSelect2:sqlSelect2,
label1:label1,
label2:label2,
},
colNames:['Label','Account_Num','Amount', 'Type Code', 'Record Code', 'Sequence'],
colModel :[
{name:'label', index:'label', width:150, align:'center', sortable:false, editable:true},
{name:'cntrct_id', index:'cntrct_id', width:150, align:'center', sortable:true},
{name:'amount', index:'amount', width:150, align:'center', sortable:false, editable:true},
{name:'type_cd', index:'type_cd', width:150, align:'center', sortable:false, editable:true},
{name:'rec_cd', index:'rec_cd', width:150, align:'center', sortable:false},
{name:'db_seq', index:'db_seq', width:150, align:'center', sortable:false},
],
editurl: 'functions.php',
extraparam: { action: function(){ return 'grdAdjust'; } },
onSelectRow: function(id) {
if(id && id!==lastSel) {
jQuery('#list').restoreRow(lastSel);
jQuery('#list').editRow(id,true);
lastSel=id;
}
},
pager: '#pager',
rowNum:100,
rowList:[100,200,300,400,500,600,700,800,900,1000],
sortname: 'cntrct_id',
sortorder: 'desc',
viewrecords: true,
caption: 'Adjustments'
});
【问题讨论】:
-
您是否在 Firebug/Chrome 之类的东西中看到包含这些变量的传出 POST 操作?它应该像在
editData:参数中传递额外数据一样简单。 -
php 实际上并没有出现在浏览器中,因为我只是通过 jquery 调用 php,所以我认为我无法在 firebug 中看到 POST 变量。但是,我知道 postData 正在被接收(因为它们打印到文件中),而 editData 不是。我因此发送editData:editData:{actions:'grdAdjust'},