未捕获的TypeError:jQuery(...)。getGridParam不是函数

时间:2016-12-01 12:06:17

标签: jquery asp.net-mvc-4

我收到JavaScript错误:

  

未捕获TypeError:jQuery(...)。getGridParam不是函数

我的JQGrid申请表中的剃刀视图中有一个mvc4在提交表单时,我只想要JQGrid

中复选框行的选中值

脚本代码

(function ($) {
    $('#JQGrid1').jqGrid({


        url: '/ExamForm/GetSubjects/',
        datatype: "json",
        contentType: "application/json; charset-utf-8",
        mtype: 'GET',
        width: 950,
        height: 150,

        colNames:new Array("#",'SubjectID', 'SubjectName', 'GroupName', ' SubjectCode'),
        colModel:new Array(
                { name: 'Flag1', index: 'Flag1', edittype: 'checkbox', formatter: 'checkbox', width: 15, editable: true, editoptions: { value: "True:False" }, formatoptions: { disabled: false } },
                { name: 'SubjectID', index: 'SubjectID', width: 20, key: true },
                 { name: 'SubjectName', index: 'SubjectName', width: 60 },
                 {
                     name: 'GroupName', index: 'GroupName', width: 60, editable: true,
                     editrules: {
                         required: true,
                         edithidden: true
                     },
                     hidden: true
                 },
                 { name: 'SubjectUniversityCode', index: 'SubjectUniversityCode', width: 20 }

        ),
        rowNum: 100,
        //pager: "#JQGrid1_pager",
        loadonce: true,
        grouping: true,
        groupingView: {
            groupField: ['GroupName']

        },
        multiselect: true,
        pager: '#JQGrid1_pager',

    });
    jQuery("#JQGrid1_pager").jqGrid('navGrid', '#JQGrid1_pager', { edit: true, add: true, del: true });

    }

})(jQuery);

function getSelectedRows() {

    var grid = $("#JQGrid1");

    //var rowkey = jQuery("#JQGrid1").jqGrid('getGridParam', 'selarrrow');
    //var rowids = grid.jqGrid('getGridParam', 'selrow');
    var rowids = jQuery("#JQGrid1").getGridParam('selrow');
    alert(rowids);
    var rowKey = grid.getGridParam("selrow");
    alert(rowkey);
    if (!rowKey)
        alert("No rows are selected");
    else {
        var selectedIDs = grid.getGridParam("selarrrow");
        var result = "";
        for (var i = 0; i < selectedIDs.length; i++) {
            result += selectedIDs[i] + ",";
        }

        alert(result);
    }

}

0 个答案:

没有答案