0

ここに私のグリッド定義があります

       $("#requestSearchResultsGrid").jqGrid({
                        datatype : 'jsonstring',
                        height : 210,
                        colModel : [
                                {
                                    label : '<input type="checkbox" id="reqChkIdResult" name="selectedCheck" value="" onclick="checkAllRequestSearchResults(event)"/>',
                                    name : '',
                                    index : '',
                                    align : 'center',
                                    editable : true,
                                    sortable : false,
                                    resizable : false,
                                    edittype : 'checkbox',
                                    editoptions : {
                                        value : "true:false"
                                    },
                                    formatter : function cboxFormatter(cellvalue,options,rowObject) {
                                        return '<input type="checkbox" name="selectedCheck"'
                                                + (cellvalue ? ' checked="checked"' : '')
                                                + 'onclick="checkRequestSearchResults()" id="'
                                                + options.rowId
                                                + '_veh" name="exp"/>';
                                    },
                                    formatoptions : {
                                        disabled : false
                                    },
                                    width : 20
                                },

                                {
                                    label : 'Dept',
                                    name : 'deptId',
                                    index : 'deptId',
                                    sortable : false,
                                    align : 'right',
                                    width : 40
                                },
                                {
                                    label : 'Class',
                                    name : 'classId',
                                    index : 'classId',
                                    sortable : false,
                                    align : 'right',
                                    width : 40
                                },
                                {
                                    label : 'SKU',
                                    name : 'skuNum',
                                    index : 'skuNum',
                                    sortable : true,
                                    width : 90,
                                    align : 'right'
                                },
                                {
                                    label : 'SKU Description',
                                    name : 'skuDesc',
                                    index : 'skuDesc',
                                    sortable : true,
                                    width : 120,
                                    align : 'left'
                                },
                                {
                                    label : 'ID',
                                    name : 'reqId',
                                    index : 'reqId',
                                    sortable : true,
                                    width : 40,
                                    align : 'right'
                                },
                                {
                                    label : 'Request Description',
                                    name : 'reqDesc',
                                    index : 'reqDesc',
                                    width : 150,
                                    align : 'left'
                                },
                                {
                                    label : 'Event Type',
                                    name : 'eventTypeName',
                                    index : 'eventTypeName',
                                    sortable : false,
                                    width : 75,
                                    align : 'left'
                                },
                                {
                                    label : 'Due Date',
                                    name : 'dueDate',
                                    index : 'dueDate',
                                    width : 70,
                                    align : 'right'
                                },
                                {
                                    label : 'Workflow Status',
                                    name : 'workflowStatusDesc',
                                    index : 'workflowStatusDesc',
                                    sortable : false,
                                    align : 'left',
                                    width : 120
                                },
                                {
                                    label : 'Selection Status',
                                    name : 'selectionStatusDesc',
                                    index : 'selectionStatusDesc',
                                    sortable : false,
                                    align : 'left',
                                    width : 120
                                },
                                {
                                    label : 'Validation Status',
                                    name : 'validationStatusDesc',
                                    index : 'validationStatusDesc',
                                    sortable : false,
                                    align : 'left',
                                    width : 120
                                },
                                {
                                    label : 'Event Name',
                                    name : 'eventName',
                                    index : 'eventName',
                                    width : 100,
                                    align : 'left'
                                },
                                {
                                    label : 'Phase',
                                    name : 'phase',
                                    index : 'phase',
                                    width : 80,
                                    align : 'left'
                                },
                                {
                                    label : 'Run Start',
                                    name : 'runStart',
                                    index : 'runStart',
                                    sortable : false,
                                    width : 70,
                                    align : 'right'
                                },
                                {
                                    label : 'Run End',
                                    name : 'runEnd',
                                    index : 'runEnd',
                                    sortable : false,
                                    width : 70,
                                    align : 'right'
                                },
                                {
                                    label : 'Supplier',
                                    name : 'supplierName',
                                    index : 'supplierName',
                                    sortable : false,
                                    width : 60,
                                    align : 'right'
                                },
                                {
                                    label : 'Owner',
                                    name : 'assignedUserId',
                                    index : 'assignedUserId',
                                    sortable : false,
                                    width : 100,
                                    align : 'left'
                                },
                                {
                                    label : 'Private',
                                    name : 'pvtInd',
                                    index : 'pvtInd',
                                    sortable : false,
                                    align : 'left',
                                    width : 50
                                },
                                {
                                    label : 'Last Modified',
                                    name : 'lastModified',
                                    index : 'lastModified',
                                    sortable : false,
                                    align : 'right',
                                    width : 110
                                } ],
                        jsonReader : {
                            root : "requestDetails",
                            repeatitems : false
                        },
                        onSelectRow : function(rowId) {
                            selectedRowId = rowId;
                        },

                        afterInsertRow : function(rowid,rowdata) {
                            var currentDate = new Date();
                            currDate = currentDate.getDate();
                            currYear = currentDate.getFullYear();
                            currMonth = currentDate.getMonth();

                            var dat = new Date(rowdata.dueDate);
                            pdate = dat.getDate();
                            pmonth = dat.getMonth();
                            pyear = dat.getYear();

                            if ((pdate > currDate) && (pdate <= currDate + 3)) {
                                $(this).jqGrid('setRowData',rowid,false,{color : 'red'});
                            }
                        },
                        gridComplete : function(){
                            $("#requestSearchResultsGrid tr").jscontext({html : requestContextMenu});
                        },
                        rowNum : 100,
                        sortorder : 'asc',
                        sortname : 'requestType',
                        viewrecords : true,
                        loadonce : true,
                        autowidth : true,
                        shrinkToFit : false,
                        gridview : true,
                        scrollOffset : 0,
                        id : 'requestId',
                        ondblClickRow : editRequest
                    }).jqGrid('setGridWidth',$('#appBody').width() - 10);

以下のスニペットを使用して、サービスからグリッドにデータを追加しています。i は増分変数です。いくつかの条件に基づいて、グリッドにデータを追加するだけなので、addRowData を使用しています。

$("#requestSearchResultsGrid").jqGrid('addRowData',i + 1, gridData);

問題は、上記の行が実行時例外のスローを実行しているときです。

TypeError: tp is undefined at ni = tprownumbers===true ? 1:0;

4

1 に答える 1