fnFooterCallback - Footer Total - aaData, iEnd, iStart are always empty / 0

fnFooterCallback - Footer Total - aaData, iEnd, iStart are always empty / 0

DaharkDahark Posts: 28Questions: 1Answers: 0
edited June 2014 in Free community support

Hello There,

I have succesfully used the fnFooterCallback function to summarise a table Column. But this was when I was putting all the table Data in to the Dom and then rendering it as a DataTable.

Now I have made another Table and I'm not injecting the Data directly into the DOM but I'm dynamicly adding the Data by a DataObject. It seems the fnFooterCallback does work, but it starts to early...it is trying to summarise the Columns, before the Data is inserted into the table.

My Setup of the empty Table, without Data (data get's inserted by a selection in another Table):

"TableDefinition" : {
            "columns" : [
                {
                    "title" : "ID",
                    "data" : "ID"
                },
                {
                    "title" : "Produktname",
                    "data" : "Title"
                },
                {
                    "title" : "Status",
                    "data" : "Status"
                },
                {
                    "title" : "Preis",
                    "data" : "Price"
                }
            ],
            "deferRender" : true,
            "bJQueryUI": true,
            "sPaginationType": "full_numbers",
            "iDisplayLength": 25,
            "aLengthMenu": [[25, 50, 100, -1], [25, 50, 100, "All"]],
            "columnDefs": [{
                "class": "TS-TXT-Right", 
                "targets": [3]
            }],
            "fnFooterCallback": function ( nRow, aaData, iStart, iEnd, aiDisplay ) {
                
                getTablePriceSum(nRow, aaData, iStart, iEnd, aiDisplay, [3]);
                
            }
        }

Remark: This is build as an object because I'm dynamicly loading multiple tables.

The Data injection

    var dataObj = [];
    
    for (p in products)
    {
        var curProduct = products[p];
        dataObj.push({
            "ID" : curProduct.ID,
            "Title" : curProduct.Title,
            "Status" : curProduct.Status,
            "Price" : parseFloat(curProduct.PriceCustomer).format(4,3,".",",") + " €"
            });
    }
    
    oTable[resultTableSelector].rows.add(dataObj).draw();

Anyone any Idea if my setup is wrong?

Answers

This discussion has been closed.