本文介绍了无法获取属性'style'对象的值为null或undefined的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 嗨 i我在运行页面时遇到控制台错误无法获取属性'样式'对象的值为null或未定义,但功能正常。 以下是我的代码 功能 Viewduplicatebatchlineitems (){ showPleaseWaitOnDataTable(' viewbatchduplicatelineitems'); $ .ajax({ dataType:' json', url: / Invoice / GetDuplicateBatchlineitems, data: [email protected], 输入: POST, success: function (msg){ var statusIdTimeSheet = @ ViewBag.statusid h idePleaseWaitOnDataTable(' viewbatchduplicatelineitems'); var aoColumns = [ { mData: CWNumber}, { mData: TimeSheetDate, sClass: date}, { mData: chargeNumber}, { mData: paycode}, { mData: Regularhours, sClass: 小时}, { mData: overtimehours, sClass: hours}, { mData: DoubleTimeHours, sClass: hours}, { mData: FinalRegularBillRate, sClass: rate}, { mData: FinalOverTimeBillRate, sClass: rate}, { mData: FinalDoubleTimeBillRate, sClass: rate}, { mData: SupplierRegularBillRate, sClass: rate}, { mData : SupplierOverTimeBillRate, sClass: rate}, { mData: SupplierDoubleTimeBillrate, sClass: rate}, { mData: CurrencyCode} ]; setDatatableWithParamwithExportForDiscrapency(msg.aaData,aoColumns,' viewbatchduplicatelineitems',' ',舍入); reBindValuesNew( viewbatchduplicatelineitems,舍入); } }); } function setDatatableWithParamwithExportForDiscrapency(aoData,aoCloumns, gridName,filterId,rounding){ try { var oTable; oTable = $(' #' + gridName).dataTable({ bLengthChange: false , iDisplayLength: 20 , bInfo: false , bFilter: true , bAutoWidth: true , bJQueryUI: true , bStateSave: false , bDestroy: true , aaSorting:[], aoColumns :aoCloumns, aaData:aoData, fnDrawCallback: function (){ disableSortColumn(); reBindValuesFordiscrapency(gridName,rounding); }, sPaginationType: 输入, sDom:' T<clear> Blrtip', // 不在I8工作 buttons:[' copy',' csv',' print'] }); $( # + gridName + _ filter)。hide(); $( # + filterId).keyup( function (){ fnFilterGlobalMVC(oTable,filterId); reBindValuesFordiscrapency(gridName,rounding); }); } catch (e){} if (aoData == ' ' || aoData.length == 0 ){ messageDivDataTable(gridName); document .getElementById(' NoRecorde').style.visibility = hidden; } else { $(' #NoRecordsDivMessage')。html(' '); document .getElementById(' NoRecorde').style.visibility = visible; } } 谢谢提前... 我尝试过: not not not得到任何线索如何解决这个解决方案 .ajax({ dataType:' json', url: / Invoice / GetDuplicateBatchlineitems, data: [email protected], type: POST, success: function (msg){ var statusIdTimeSheet = @ ViewBag.statusid hidePleaseWaitOnDataTable(' viewbatchduplicatelineitems' ); var aoColumns = [ { mData: CWNumber}, { mData: TimeSheetDate, sClass: date}, { mData: chargeNumber}, { mData: paycode}, { mData: Regularhours, sClass: 小时}, { mData: overtimehours, sClass: hours}, { mData: DoubleTimeHours, sClass: hours}, { mData: FinalRegularBillRate, sClass: rate}, { mData: FinalOverTimeBillRate, sClass: rate}, { mData: FinalDoubleTimeBillRate, sClass: rate}, { mData: SupplierRegularBillRate, sClass: rate}, { mData : SupplierOverTimeBillRate, sClass: rate}, { mData: SupplierDoubleTimeBillrate, sClass: rate}, { mData: CurrencyCode} ]; setDatatableWithParamwithExportForDiscrapency(msg.aaData,aoColumns,' viewbatchduplicatelineitems',' ',舍入); reBindValuesNew( viewbatchduplicatelineitems,舍入); } }); } function setDatatableWithParamwithExportForDiscrapency(aoData,aoCloumns, gridName,filterId,rounding){ try { var oTable; oTable = (' #' + gridName).dataTable({ bLengthChange: false , iDisplayLength: 20 , bInfo: false , bFilter: true , bAutoWidth: true , bJQueryUI: true , bStateSave: false , bDestroy: true , aaSorting:[], aoColumns:aoCloumns, aaData :aoData, fnDrawCallback: function (){ disableSortColumn(); reBindValuesFordiscrapency(gridName,rounding); }, sPaginationType: 输入, sDom:' T<clear> Blrtip', // 不在I8工作 buttons:[' copy',' csv',' print'] }); ( # + gridName + _过滤器)隐藏(); Hii am getting console error "unable to get value of the property 'style' object is null or undefined" while running the page, however functionality is working fine.Below is my codefunction Viewduplicatebatchlineitems() { showPleaseWaitOnDataTable('viewbatchduplicatelineitems'); $.ajax({ "dataType": 'json', "url": "/Invoice/GetDuplicateBatchlineitems", "data": "[email protected]", "type": "POST", "success": function (msg) { var statusIdTimeSheet = @ViewBag.statusid hidePleaseWaitOnDataTable('viewbatchduplicatelineitems'); var aoColumns = [ { "mData": "CWNumber"}, { "mData": "TimeSheetDate" ,"sClass": "date"}, { "mData": "chargeNumber"}, { "mData": "paycode"}, { "mData": "Regularhours", "sClass": "hours" }, { "mData": "overtimehours", "sClass": "hours" }, { "mData": "DoubleTimeHours", "sClass": "hours" }, { "mData": "FinalRegularBillRate", "sClass": "rate" }, { "mData": "FinalOverTimeBillRate", "sClass": "rate" }, { "mData": "FinalDoubleTimeBillRate", "sClass": "rate" }, { "mData": "SupplierRegularBillRate", "sClass": "rate" }, { "mData": "SupplierOverTimeBillRate", "sClass": "rate" }, { "mData": "SupplierDoubleTimeBillrate", "sClass": "rate" }, { "mData": "CurrencyCode"} ]; setDatatableWithParamwithExportForDiscrapency(msg.aaData, aoColumns, 'viewbatchduplicatelineitems', '', rounding); reBindValuesNew("viewbatchduplicatelineitems", rounding); } }); }function setDatatableWithParamwithExportForDiscrapency(aoData, aoCloumns, gridName, filterId, rounding) { try { var oTable; oTable = $('#' + gridName).dataTable({ "bLengthChange": false, "iDisplayLength": 20, "bInfo": false, "bFilter": true, "bAutoWidth": true, "bJQueryUI": true, "bStateSave": false, "bDestroy": true, "aaSorting": [], "aoColumns": aoCloumns, "aaData": aoData, "fnDrawCallback": function () { disableSortColumn(); reBindValuesFordiscrapency(gridName, rounding); }, "sPaginationType": "input", "sDom": 'T<"clear">Blrtip', //Not Working in I8 "buttons": ['copy', 'csv', 'print'] }); $("#" + gridName + "_filter").hide(); $("#" + filterId).keyup(function () { fnFilterGlobalMVC(oTable, filterId); reBindValuesFordiscrapency(gridName, rounding); }); } catch (e) { } if (aoData == '' || aoData.length == 0) { messageDivDataTable(gridName); document.getElementById('NoRecorde').style.visibility = "hidden"; } else { $('#NoRecordsDivMessage').html(''); document.getElementById('NoRecorde').style.visibility = "visible"; }}Thanks in advance...What I have tried:not getting any clue how to fix this 解决方案 .ajax({ "dataType": 'json', "url": "/Invoice/GetDuplicateBatchlineitems", "data": "[email protected]", "type": "POST", "success": function (msg) { var statusIdTimeSheet = @ViewBag.statusid hidePleaseWaitOnDataTable('viewbatchduplicatelineitems'); var aoColumns = [ { "mData": "CWNumber"}, { "mData": "TimeSheetDate" ,"sClass": "date"}, { "mData": "chargeNumber"}, { "mData": "paycode"}, { "mData": "Regularhours", "sClass": "hours" }, { "mData": "overtimehours", "sClass": "hours" }, { "mData": "DoubleTimeHours", "sClass": "hours" }, { "mData": "FinalRegularBillRate", "sClass": "rate" }, { "mData": "FinalOverTimeBillRate", "sClass": "rate" }, { "mData": "FinalDoubleTimeBillRate", "sClass": "rate" }, { "mData": "SupplierRegularBillRate", "sClass": "rate" }, { "mData": "SupplierOverTimeBillRate", "sClass": "rate" }, { "mData": "SupplierDoubleTimeBillrate", "sClass": "rate" }, { "mData": "CurrencyCode"} ]; setDatatableWithParamwithExportForDiscrapency(msg.aaData, aoColumns, 'viewbatchduplicatelineitems', '', rounding); reBindValuesNew("viewbatchduplicatelineitems", rounding); } }); }function setDatatableWithParamwithExportForDiscrapency(aoData, aoCloumns, gridName, filterId, rounding) { try { var oTable; oTable =('#' + gridName).dataTable({ "bLengthChange": false, "iDisplayLength": 20, "bInfo": false, "bFilter": true, "bAutoWidth": true, "bJQueryUI": true, "bStateSave": false, "bDestroy": true, "aaSorting": [], "aoColumns": aoCloumns, "aaData": aoData, "fnDrawCallback": function () { disableSortColumn(); reBindValuesFordiscrapency(gridName, rounding); }, "sPaginationType": "input", "sDom": 'T<"clear">Blrtip', //Not Working in I8 "buttons": ['copy', 'csv', 'print'] });("#" + gridName + "_filter").hide(); 这篇关于无法获取属性'style'对象的值为null或undefined的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-21 05:22