0

我在 jqGrid 中有一个子网格,它工作得非常好。但是,我想为 onSelectRow 添加一个事件,就像我在主网格中一样。那可能吗?我的网格定义:

    $("#skeppsdagbok_grid").jqGrid({
        datatype: 'local',
        mtype: 'GET',
        colNames: [
                'Datum',
                'Tid',
                'Tkn',
                'Lat',
                'Tkn',
                'Long',
                'Kurs',
                'Fart',
                'Anteckning',
                'Sign',
                'OK',
                'Skapad'],
        colModel: [
              { name: 'Datum', sortable: false, width: 70, formatter: 'date' },
              { name: 'Tid', sortable: false, width: 65, formatter: 'date', formatoptions: { srcformat: 'H:i:s', newformat: 'ShortTime'} },
              { name: 'LatitudTecken', sortable: false, width: 10 },
              { name: 'Latitud', sortable: false, width: 50 },
              { name: 'LongitudTecken', sortable: false, width: 10 },
              { name: 'Longitud', sortable: false, width: 50 },
              { name: 'Kurs', sortable: false, width: 50 },
              { name: 'Fart', sortable: false, width: 50 },
              { name: 'Anteckning', sortable: false, width: 100 },
              { name: 'Sign', sortable: false, width: 50 },
              { name: 'OK', sortable: false, width: 30, formatter: 'checkbox' },
              { name: 'Skapad', sortable: false, width: 100 }
            ],
        rowNum: -1,
        rownumbers: true,
        ignoreCase: true,
        viewrecords: true,
        gridview: true,
        shrinkToFit: false,
        width: 750,
        height: 465,
        caption: 'Skeppsdagbok',
        jsonReader: {
            root: "rows",
            page: "page",
            total: "total",
            records: "records",
            repeatitems: true,
            cell: "cell",
            id: "id",
            subgrid: {
                root: "rows",
                repeatitems: true,
                cell: "cell",
                id: "id"
            }
        },
        subGrid: true,
        subGridUrl: '@Url.Action("GetGamlaSkeppsdagboksrader")',
        subGridModel: [
            {
                name: [
                'Datum',
                'Tid',
                'Tkn',
                'Lat',
                'Tkn',
                'Long',
                'Kurs',
                'Fart',
                'Anteckning',
                'Sign',
                'OK',
                'Skapad'],
                width: [
                    70,
                    35,
                    20,
                    50,
                    20,
                    50,
                    40,
                    40,
                    150,
                    50,
                    50,
                    100
                ]
            }
        ],
        onSelectRow: function (id) {
            getSkeppsdagboksanteckning(id);
        }
    });
4

1 回答 1

0

我认为您可以将子网格用作网格,然后您可以使用与 jqGrid 关联的事件。查看此链接以供进一步参考。

于 2012-08-14T09:37:49.540 回答