Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data Tables - Scroller Missing Column Headers on Refresh

I'm using the new Data Tables extra plugin - Scroller.

However, I am having trouble when refreshing the existing Data Table Grid with a new data source array from an ajax request. (Code below).

The first time I run this exact code on the page, it works properly. However, whenever I call this code snippet again given a different source, the data table is re-rendered but is missing all column headers. Does anyone know why the Columns are disappearing every subsequent time after the first?

oTable = $('#example').dataTable({
                                "aoColumns": [
                                    { "sTitle": "ID" },
                                    { "sTitle": "Test" },
                                    { "sTitle": "Type" },
                                    { "sTitle": "Date" },
                                    { "sTitle": "Revision" }
                                ],
                                "aaData": source,
                                "bDestroy":true,
                                "sScrollY": "380px",
                                "sDom": 'frtiS',
                                "bDeferRender": true,
                                "fnRowCallback": function(nRow, aData, iDisplayIndex, iDisplayIndexFull) {
                                    $(nRow).attr('id', "row-" + aData[0]);
                                    return nRow;
                                }
                            });
like image 451
Garrett Avatar asked Dec 20 '25 13:12

Garrett


1 Answers

I have also had the same problem and here is the answer from Allan and it worked perfectly in my case. http://www.datatables.net/forums/discussion/14278/scroller-plugin-misplaces-datatables-column-header#Item_1

like image 127
Mohan Timilsina Avatar answered Dec 22 '25 03:12

Mohan Timilsina



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!