1

我需要将一个额外的参数(即 selected row_id)传递给我用来显示子网格的 url。但是 Firebug 控制台面板显示没有传递额外的参数。(当然服务器端代码也没有收到它)。

下面是我的代码,

myGrid.jqGrid({
    url: 'server.php',
    datatype: "json",
    mtype: 'POST',
    width: 900,
    height:500,
    sortname: 'productid',
    viewrecords: true,
    sortorder: "desc",
    caption: "JSON Example",
    rowNum: 100,
    subGrid: true,
    colNames: ['Product Id', 'Product Name', 'Supplier Id', 'Unit Price'],
    colModel: [
        {
        name: 'productid',
        index: 'productid',
        search: true,
        width: 55
    }, {
        name: 'productname',
        index: 'productname',
        width: 90,
        search: true
    }, {
        name: 'supplierid',
        index: 'supplierid',
        width: 100,
        search: false
    }, {
        name: 'unitprice',
        index: 'unitprice',
        width: 80,
        search: false,
        align: "right",
        search: true
    }
    ],

    subGridRowExpanded: function (subgrid_id, row_id) {
        var subgrid_table_id, 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>");
        jQuery("#" + subgrid_table_id)
                .jqGrid({
                    url: "server.php",
                    datatype: "json",
                    colNames: ['Product Id', 'Product Name'],
                    width:700,
                    colModel: [{
                        name: 'productid',
                        index: 'productid',
                        width: 55

                    }, {
                        name: 'productname',
                        index: 'productname',
                        width: 90
                    }],
                    rowNum: 20,
                    sortname: 'num',
                    sortorder: "asc"
                    data: {prodcutid: row_id}

                });
    }

如何将选定的行 id 传递给子网格的 url?

谢谢

4

1 回答 1

2

data 参数在 jqGrid 中与jQuery.ajax. 所以你应该更换

data: {prodcutid: row_id}

在子网格中

postData: {prodcutid: row_id}
于 2012-10-10T16:15:02.577 回答