无法读取脚本中null的属性“长度”

时间:2019-10-11 01:49:32

标签: javascript c# jquery html asp.net

我正在尝试从脚本后面的代码中调用函数。该功能我只是返回员工名单 我只是试图不使用网格视图。 我只是在同一项目中复制代码,然后更改函数名称和colModel内部的名称:[] 这是我的脚本:

function loadMoretha60grid() {
    $('#timesheetgrid').jqGrid("GridUnload");
    getmoreThan60(function (data) { loadTimesheetTableMoeretha60(data); });

}
function loadTimesheetTableMoeretha60(timelog) {
    var lastsel;
    var startpage = 1;
    $('#timesheetgrid').jqGrid({
        datatype: 'local',
        data: timelog,
        editurl: 'clientArray',
        colNames: ['CompanyID', 'EMPName', 'START_DATE', 'END_DATE',
            'TOTALHOURS'],

        colModel: [
            { name: 'CompanyID', index: 'CompanyID', editable: 'false', align: 'center', width: '150', sortable: false, },
            { name: 'EMPName', index: 'EMPName', editable: 'false', align: 'center', width: '275', resizable: false },
            { name: 'START_DATE', index: 'START_DATE', editable: 'false', align: 'center', width: '175', resizable: false },
             { name: 'END_DATE', index: 'END_DATE', editable: 'false', align: 'center', width: '175', resizable: false },
              { name: 'TOTALHOURS', index: 'TOTALHOURS', editable: 'false', align: 'center', width: '175', resizable: false },

        ],
        pager: '#timesheetgridpager',
        viewrecords: true,
        forceFit: false,
        shrinkToFit: false,
        width: '1000',
        emptyrecords: "No Record/s found",
        loadtext: "Loading",
        rowList: [5, 10, 20, 50],
        height: 'auto',
        caption: 'Timesheet Listing'

    });

    $('#timesheetgrid').jqGrid('navGrid', '#timesheetgridpager', {
        edit: false,
        save: false,
        add: false,
        cancel: false,
        del: false,
        search: false,
        refresh: false
    });
    $('#timesheetgrid').jqGrid('inlineNav', '#timesheetgridpager', {
        add: false,
        edit: false,
        save: false,
        cancel: false,
        restoreAfterSelect: false
    });
}
function getmoreThan60(callback) {

    var timelog = [],
        params = {
            name: $('#empnamebox').val(),
            dateStart: '2019-09-01',
            dateEnd: '2019-09-29'
        };
    showLoadingGif();
    $.ajax({
        async: true,
        type: 'POST',
        contentType: 'application/json',
        url: baseUrl + 'Timesheet.aspx/getMore60hrs',
        data: JSON.stringify(params),
        dataType: 'json',
        success: function (data) {
            timelog = data.d;
            hideLoadingGif();
            if (typeof callback != 'undefined')
                callback(timelog);
        },
        error: function (xhr, status, error) {
            console.log(xhr, status, error);
            hideLoadingGif();
        }
    });


}

enter image description here

这是我的方法

  [WebMethod]
        public static void getMore60hrs(string name,string dateStart,string dateEnd) {
            TDKDataAccessLayer dataAcc = new TDKDataAccessLayer();
            List<morethan> records = new List<morethan>();
            dataAcc.DepartID = Convert.ToInt32(DeptID);
            dataAcc.Name = name;
            dataAcc.DateStart = dateStart;
            dataAcc.DateEnd = dateEnd;
           records = dataAcc.MoreThan60hrs();

        }

顺便说一句 我不知道该怎么办,因为我来自Windows窗体C#

0 个答案:

没有答案