TypeError: oSettings.aoColumns[iColumn] is undefined

TypeError: oSettings.aoColumns[iColumn] is undefined

miriam22miriam22 Posts: 6Questions: 2Answers: 0

Hello =)

I have a problem with the datatable. I don't have a clue why this error appears. I had a look at possible causes to this problem, but didn't find a match with mine. As far as I know the tablebody and -header have exactly the same amount of entries and there's no problem with the sorting. This error appears every time I load the table for the first time after login, and sometimes it disappears after the first or fifth refresh. Then it don't occurs again, until i logout and login again. It's kinda annoying, because I don't have a solution for this. Perhaps you can help me with this issue =) that would be great.
BTW I'm using Datatable 1.9.4 and whenever this error occurs no data is loaded for the table. After several refreshs it's working like a charm.
Kind Regards Miriam

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Can you link to a test case showing the issue please. Also, what happens if you update to 1.10?

    Allan

  • miriam22miriam22 Posts: 6Questions: 2Answers: 0

    Thank you for the fast reply, Allan.
    I'm afraid. I don't have a test case for this, because it just appeared. But I can try to explain when it happens.

    First some informations about the implementation:
    The tabledata is loaded via fnServerParams, where a method 'loadListData' is called. So the data is created in a ListEntryBuilder-class, which creates the entries for the list and gives them back to the table and fills the aoData.

    I found out that for some lists the fnServerParams is just not performed, so the loadListData is not called on the inital load. But if it is refreshed with F5, the fnServerParams is called and so is the loadListData. I don't know why, but if i press the button which is to load the data, the function is ignored again. And again... perhaps, but then it works until the session is released.

    Well... why do we not update to 1.10? I don't know ^^ but I don't think that we'll update anytime soon.

    Kind Regards, Miriam

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    Hi Miriam,

    Thanks for the explanation, however, I'm afraid I'm not sure what is going wrong. I suspect I would need a test case to be able to offer any help here.

    Allan

  • miriam22miriam22 Posts: 6Questions: 2Answers: 0

    Hi again,

    since i tried with jsFiddle - and failed to make a working test case - I have some code snippets, which show the initialization of the table.

    oTable = $("#listtable").dataTable({
            "aaSorting": [[ 2, "desc" ]],
            "bProcessing" : true,
            "bStateSave" : true,
            "bAutoWidth": false,
            "fnStateLoad" : loadTableState,
            "bJQueryUI" : true,
            "bPaginate" : true,
            "bInfo" : true,
            "iDisplayLength" : ${iDisplayLength},
            "sPaginationType" : "input",
            "sDom" : "Rr<\"dTover\"t><\"dTank\"><\"dTfooter\"<pliC>>",
            "fnServerParams" : function(aoData) {
                aoData.push({"name" : "todo", "value" : "loadListData"});
                var filters = getFilters();
                $.each(filters, function(){
                    if ($(this)[0].active)
                        aoData.push($(this)[0]);
                });
                saveFilters(filters);
            },
            "fnServerData" : function(sSource, aoData, fnCallback, oSettings) {
                oSettings.jqXHR = $.ajax({
                    "dataType" : 'json',
                    "type" : "GET",
                    "cache":false,
                    "url" : sSource,
                    "data" : aoData,
                    "success": getCallback(fnCallback),
                    "error" : getMainListErrorCallback(fnCallback)
                });
                storeValue("displayStart", oSettings._iDisplayStart);
            },
            "fnRowCallback": function( nRow, aData, iDisplayIndex )
            {
                $(nRow).prop("id", "o_" + aData["oId"]);
                if (aData["rowColor"] != null && aData["rowColor"] != "")
                {
                    $(nRow).addClass(aData["rowColor"]);
                    if (aData["variantChild"])
                    {
                        if (!aData["vaChilExpanded"])
                            $(nRow).hide();
                        $(nRow).addClass("par_" + aData["vaParId"]);
                    }
                }
            },
            "aoColumns": [
                          { "mData": hdlSelectionColumn, "bSortable": false, "sWidth": "25px", "sClass" : "center donotcolor"},
                          { "mData": hdlIconColumn, "bSortable": false, "sWidth": "25px", "sClass" : "center donotcolor"},
                          { "mData": "offerId", "bVisible" : false },
                          { "mData": "itemId", "bVisible" : false },
                          { "mData": "intItemNo", "bVisible" : true, "bSortable": true, "sWidth": "150px" },
                          { "mData": "title", "bVisible" : true, "bSortable": true, "sWidth": "250px" },
                          { "mData": "acc", "bVisible" : true, "bSortable": true, "sWidth": "150px" },
                          { "mData": "price", "bVisible" : true, "bSortable": true, "sWidth": "100px", "sClass" : "numeric" },
                          { "mData": "specialPrice", "bVisible" : true, "bSortable": true, "sWidth": "100px", "sClass" : "numeric" },
                          { "mData": "listQty", "bVisible" : true, "bSortable": false, "sWidth": "105px", "sClass" : "numeric" },
                          { "mData": "stock", "bVisible" : true, "sWidth": "134px", "bSortable": false, "sClass" : "numeric"},
                          { "mData": "startDate", "bVisible" : true, "bSortable": true, "sWidth": "120px" },
                          { "mData": "refillQty", "bVisible" : false, "bSortable": false,"sWidth": "90px", "sClass" : "numeric" },
                          { "mData": "currentQty", "bVisible" : true, "bSortable": true, "sWidth": "160px", "sClass" : "numeric" },
                          { "mData": "lastListQty", "bVisible" : false, "bSortable": true, "sWidth": "140px", "sClass" : "numeric" },
                          { "mData": "soldQty", "bVisible" : true, "bSortable": true, "sWidth": "115px", "sClass" : "numeric" },
                          { "mData": "reservedStock", "bVisible" : false, "bSortable": true, "sWidth": "140px", "sClass" : "numeric" },
                          { "mData": "manufacturer", "bVisible" : false, "bSortable": true, "sWidth": "150px" },
                          { "mData": "deliveryTime", "bVisible" : false, "bSortable": true, "sWidth": "150px" },
                          { "mData": "sUrl", "bVisible" : false },
                        ]
            ,
            "oColVis" : {
                "aiExclude": [ 0,1,2,3,19 ],
                "buttonText": showHideTranslation
            },
            "oColReorder": { "iFixedColumns": 1 },
            "fnDrawCallback": function (o) { adjustColVis(o) },
            "oLanguage": tableTranslations,
            "fnInitComplete": function(oSettings, json) {
                oSettings.oFeatures.bServerSide = true;
                oSettings.sAjaxSource = ajaxurl;
                oSettings.fnStateSave = saveTableState;}
        });
    

    This is the body of the table, which is filled from the java-source.

    <table id="listtable">
            <thead>
                <tr>
                    <th id="thExpander"></th>
                    <th id="thOTypeIcon"></th>
                    <th id="thId">id</th>
                    <th id="thItemId">id</th>
                    <th id="thIntItemNo">Internal Item Number</th>
                    <th id="thIdent">Identifier</th>
                    <th id="thAcc">Account</th>
                    <th id="thPrice">Price</th>
                    <th id="thSpecPrice">Special Price</th>
                    <th id="thListQty">Listing Quantity</th>
                    <th id="thStock">Stock</th>
                    <th id="thStartdate">Start Date</th>
                    <th id="thRefillQty">Refill Quantity</th>
                    <th id="thCurrQty">Curr Quantity</th>
                    <th id="thLastListQty">Last Listing Qty</th>
                    <th id="thSoldQty">Sold Qty</th>
                    <th id="thReservedQty">Reserved Qty</th>
                    <th id="thManufacturer">Manufacturer</th>
                    <th id="thDeltime">Delivery Time</th>
                    <th id="thSUrl">Url</th>
                </tr>
            </thead>
            <tbody>
            </tbody>
        </table>
    

    And this is the header of the table. I hope this helps a bit to figure out what's the problem. I really don't know why sometimes when initializing the table, the fnServerParams is not performed.

    Kind Regards, Miriam

  • miriam22miriam22 Posts: 6Questions: 2Answers: 0

    Is there any possibility that the fnServerParams can be ignored or bypassed? And if so, what is the reason? I'm going to be a little bit desperate, because I don't find the cause of this problem. And I was searching for a solution a long time now. Perhaps someone can help with this.
    Thanks =) Miriam

This discussion has been closed.