Headers showing twice when using javascript array as a source
Headers showing twice when using javascript array as a source
juan pablo
Posts: 2Questions: 0Answers: 0
Hi... this is my first post on this list... so i hope i can be descriptive enough.
I'm using datatables to generate some tables reports in HTML.
To feed the tables, i'm using a javascript array as a source ( "aaData": [["0","FIRST",],["1","SECOND",], and so long ...] ).
The problem arises when i try to save the page to a file. All the table headers and footers are shown twice (the search header,the amount of rows, the amount of records shown footer and the prev and next buttons) . Yes, i'm using search and paging.
I went directly to the html source and looked that the info for the table is being shown twice :
[code]
Show 15All entriesSearch: Processing...ClientUsername0FIRST1SECOND...Showing 1 to 15 of 2,334 entries
$(document).ready(function() { $('#table-1').dataTable({....});
[/code]
So... my guess is that when you load the table from a javascript array and save the html page, the headers and footers are shown twice because in the source there is the table data, ( look all the divs listed previously in the code, they have been added by the library) and there is also the tag, containig all the table information again. So...there might be a bug because the headers and footers are being shown twice.
I hope all the information is clear enough. Great work!
I'm using datatables to generate some tables reports in HTML.
To feed the tables, i'm using a javascript array as a source ( "aaData": [["0","FIRST",],["1","SECOND",], and so long ...] ).
The problem arises when i try to save the page to a file. All the table headers and footers are shown twice (the search header,the amount of rows, the amount of records shown footer and the prev and next buttons) . Yes, i'm using search and paging.
I went directly to the html source and looked that the info for the table is being shown twice :
[code]
Show 15All entriesSearch: Processing...ClientUsername0FIRST1SECOND...Showing 1 to 15 of 2,334 entries
$(document).ready(function() { $('#table-1').dataTable({....});
[/code]
So... my guess is that when you load the table from a javascript array and save the html page, the headers and footers are shown twice because in the source there is the table data, ( look all the divs listed previously in the code, they have been added by the library) and there is also the tag, containig all the table information again. So...there might be a bug because the headers and footers are being shown twice.
I hope all the information is clear enough. Great work!
This discussion has been closed.
Replies
[code]
$(document).ready(function() {
$('#tableDiv-1').html( ' ' );
$('#table-1').dataTable({
"bPaginate": true,
"bLengthChange": true,
...
...
[/code]
I have another question =) :
Is it possible to save the state in a "hidden field" or in the dom, instead of a cookie?... Because i need to be able to save the html page in a file and then, when the file is opened again, i need the state to be reloaded ( page size, page, etc).
Do i have to hack the _fnCreateCookie and _fnReadCookie to make them save into the DOM instead of a cookie?