DataTables is adding extra div elements
DataTables is adding extra div elements
Hello all,
I'm new to Jquery and of course DataTables. I must say, it is a great tool. I'm quite good with PHP so I managed Server Side without having problems.
The template I bought (over themeforest) is using DataTables and styling all Tables with "table" class.
When I try to add some DataTables option, it is messing up the whole table.
Table structure
[code]
ID
Category
Title
Actions
[/code]
If I don't write any options or any jquery for data tables everything works perfectly. The moment when I add (I have to add "bRetrieve": true or it is giving error) even simple language options, it is messing up the whole table.
[code]$(document).ready(function() {
$('.table').dataTable( {
"bRetrieve": true,
"oLanguage": {
"sLengthMenu": "Display _MENU_ records per page",
"sZeroRecords": "Nothing found - sorry",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ records",
"sInfoEmpty": "Showing 0 to 0 of 0 records",
"sInfoFiltered": "(filtered from _MAX_ total records)"
}
} );
} );[/code]
Template has style for tables.
If I add the code above (or code for server-side, simply any code related to datatables);
1. Adding extra (no style) MENU and Search option just above the Table header.
2. Adding extra "Showing x to x of x entries" (table bottom) no pagination.
3. Adding "No data available in table" text just under the "Showing x to x of x entries".
4. No matter how much data I have, pagination is disabled.
I will be glad if anyone could help me out with this problem I'm having.
P.S. : Screen shot can be found here : http://i56.tinypic.com/f9l1mu.jpg
I'm new to Jquery and of course DataTables. I must say, it is a great tool. I'm quite good with PHP so I managed Server Side without having problems.
The template I bought (over themeforest) is using DataTables and styling all Tables with "table" class.
When I try to add some DataTables option, it is messing up the whole table.
Table structure
[code]
ID
Category
Title
Actions
[/code]
If I don't write any options or any jquery for data tables everything works perfectly. The moment when I add (I have to add "bRetrieve": true or it is giving error) even simple language options, it is messing up the whole table.
[code]$(document).ready(function() {
$('.table').dataTable( {
"bRetrieve": true,
"oLanguage": {
"sLengthMenu": "Display _MENU_ records per page",
"sZeroRecords": "Nothing found - sorry",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ records",
"sInfoEmpty": "Showing 0 to 0 of 0 records",
"sInfoFiltered": "(filtered from _MAX_ total records)"
}
} );
} );[/code]
Template has style for tables.
If I add the code above (or code for server-side, simply any code related to datatables);
1. Adding extra (no style) MENU and Search option just above the Table header.
2. Adding extra "Showing x to x of x entries" (table bottom) no pagination.
3. Adding "No data available in table" text just under the "Showing x to x of x entries".
4. No matter how much data I have, pagination is disabled.
I will be glad if anyone could help me out with this problem I'm having.
P.S. : Screen shot can be found here : http://i56.tinypic.com/f9l1mu.jpg
This discussion has been closed.
Replies
[code]
alert( $('.table').length );
[/code]
does it give you '2' or '1'? Are you rewriting the HTML or something like that as well?
Allan
Thank you for your reply. It gives me 2. I don't know why there is only 1 table in the page. How can I use it with having the style of the theme without getting such error?
Once again, thank you for your great work.