Click here to Skip to main content
15,867,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
i 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 code
JavaScript
function Viewduplicatebatchlineitems() {
        showPleaseWaitOnDataTable('viewbatchduplicatelineitems');
        $.ajax({
            "dataType": 'json',
            "url": "/Invoice/GetDuplicateBatchlineitems",
            "data": "batchId=@ViewBag.batchid",
            "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
Posted
Updated 16-Jul-17 22:07pm
v2
Comments
F-ES Sitecore 17-Jul-17 4:33am    
"document.getElementById('NoRecorde')" is returning null, in other words there isn't an element with an id of NoRecorde on the page.

1 solution

The issue isn't jQuery because you're mixing jQuery and natural javascript:
JavaScript
document.getElementById('NoRecorde').style.visibility = "hidden";

Try using the jQuery version instead:
JavaScript
$('#NoRecorde').show();
$('#NoRecorde').hide();
 
Share this answer
 
Comments
Nityananda Das 17-Jul-17 6:38am    
Thanx Andy...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900