Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/unit-testing/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
发布带有URL的行id:扩展jqgrid以加载子网格时_Jqgrid_Jqgrid Php - Fatal编程技术网

发布带有URL的行id:扩展jqgrid以加载子网格时

发布带有URL的行id:扩展jqgrid以加载子网格时,jqgrid,jqgrid-php,Jqgrid,Jqgrid Php,我试图通过在扩展网格时将父行键(dept_id)发布到url:“sub_grid_load_dept.php”,将jqgrid加载为子网格。 但我不知道如何用一种简单的方式来做。 这是我的密码 jQuery("#grid-dept").jqGrid({ url:'grid_load_dept.php', datatype: "xml", colNames:['dept id','dept prefix','dept name'], colModel:[

我试图通过在扩展网格时将父行键(dept_id)发布到url:“sub_grid_load_dept.php”,将jqgrid加载为子网格。 但我不知道如何用一种简单的方式来做。 这是我的密码

jQuery("#grid-dept").jqGrid({
    url:'grid_load_dept.php',
    datatype: "xml",

    colNames:['dept id','dept prefix','dept name'],
    colModel:[
     {name:'dept_id',index:'dept_id', width:200, editable: true},
     {name:'dept_prefix',index:'dept_prefix', width:200, editable: true},
     {name:'dept_name',index:'dept_name', width:200, editable: true}
    ],
    loadonce:false,
    mtype: "POST",
    pager: '#grid-dept-pager',
    sortname: 'dept_id',
    sortorder: "asc",
    editable: true, 
    caption: "department",
    editurl:"grid_edit_dept.php",
    subGrid: true,
    subGridRowExpanded: function(subgrid_id, row_id) 
        {
           var subgrid_table_id;
           var pager_id;
           subgrid_table_id = subgrid_id+"_t";
           pager_id = "p_"+subgrid_table_id;
           $("#" + subgrid_id).html("<table id='"+subgrid_table_id+"' class='scroll'></table><div id='"+ pager_id +"' class='scroll'></div>");
           $("#" + subgrid_table_id).jqGrid({
              url:'sub_grid_load_dept.php',
              datatype: "xml",
              colNames: ['id','dept_id','office_id','dept_head','date_from','date_to','remarks'],
              colModel:
              [
                {name:"id",index:"id",width:80,key:true, editable:true},
                {name:"dept_id",index:"dept_id",width:130, editable:true},
                {name:"office_id",index:"office_id",width:80,align:"right", editable:true},
                {name:"dept_head",index:"dept_head",width:80,align:"right", editable:true},           
                {name:"date_from",index:"date_from",width:100,align:"right", editable:true},
                {name:"date_to",index:"date_to",width:100,align:"right", editable:true},
                {name:"remarks",index:"remarks",width:100,align:"right", editable:true}
              ],
              caption: "Department Details",
              mtype: "POST",
              sortname: 'id',
              sortorder: "asc",
              editable: true,
              pager:pager_id,
              editurl:"sub_grid_edit_dept.php"
           });
         jQuery("#"+subgrid_table_id).jqGrid('navGrid',"#"+pager_id,{edit:true,add:true,del:false,search:true,refresh:true})
   }
jQuery(“网格部门”).jqGrid({
url:'grid\u load\u dept.php',
数据类型:“xml”,
colNames:['dept id','dept prefix','dept name'],
colModel:[
{名称:'dept_id',索引:'dept_id',宽度:200,可编辑:true},
{名称:'dept_prefix',索引:'dept_prefix',宽度:200,可编辑:true},
{名称:'dept_name',索引:'dept_name',宽度:200,可编辑:true}
],
loadonce:false,
mtype:“POST”,
寻呼机:“#网格部门寻呼机”,
sortname:“部门id”,
分拣员:“asc”,
是的,
描述:“部门”,
editurl:“网格编辑部门php”,
子网格:对,
subGridRowExpanded:函数(subgrid\u id,row\u id)
{
var子网格\u表\u id;
变量寻呼机id;
子网格\表\ id=子网格\ id+“\ t”;
pager_id=“p_”+子网格\u表\u id;
$(“#”+子网格_id).html(“”);
$(“#”+子网格_表_id).jqGrid({
url:'sub_grid_load_dept.php',
数据类型:“xml”,
colNames:['id','dept\u id','office\u id','dept\u head','date\u from','date\u to','备注'],
colModel:
[
{name:“id”,index:“id”,宽度:80,键:true,可编辑:true},
{name:“dept_id”,index:“dept_id”,宽度:130,可编辑:true},
{name:“office_id”,index:“office_id”,宽度:80,对齐:“right”,可编辑:true},
{name:“dept_head”,index:“dept_head”,宽度:80,对齐:“right”,可编辑:true},
{name:“date_from”,index:“date_from”,宽度:100,对齐:“right”,可编辑:true},
{name:“date_to”,index:“date_to”,宽度:100,对齐:“right”,可编辑:true},
{名称:“备注”,索引:“备注”,宽度:100,对齐:“右”,可编辑:true}
],
描述:“部门详情”,
mtype:“POST”,
sortname:'id',
分拣员:“asc”,
是的,
寻呼机:寻呼机id,
editurl:“子网格编辑部门php”
});
jQuery(“#”+子网格_表_id).jqGrid('navGrid',“#”+pager_id,{edit:true,add:true,del:false,search:true,refresh:true})
}
我的意思是如何在subGridRowExpanded:function(subgrid_id,row_id)中发布“row_id” 通过包含在URL:proerty.maybe中作为数组。

我找到了解决方案: [http://stackoverflow.com/questions/12823591/how-to-pass-the-selected-row-id-to-the-subgrids-url-in-jqgrid][1]

Used postDATA:直接附加到url的关联数组

postData: {prodcutid: row_id}