Style for dataTables does not work for all my tabs
Style for dataTables does not work for all my tabs
drfunk
Posts: 58Questions: 8Answers: 0
in DataTables
I have 5 tabs that I would like to have the data styled
But it only works for the first tab
This question has an accepted answers - jump to answer
Answers
can't remember how to upload my code example
ok I got it now
http://live.datatables.net/qofopiru/1/
http://live.datatables.net/qofopiru/1/edit
All of your tables have the same
id
. HTML requires theid
to be unique on the page. You can use a selector that selects all the tables, assuming they all have the same configuration. Something like this:http://live.datatables.net/niradika/1/edit
See this example for more details.
Kevin
ok that works!! thanks for the quick reply appreciate it
one last question: why does the second column "Action" show next to the first column? If I click it - it does align up correctly
Sounds like you need to use
columns.adjust()
when you switch tabs. See this example for more details.Kevin
not quite understanding.
like this?
$('#container').css( 'display', 'block' );
table.columns.adjust().draw();
can you show on my code?
Looks like you might have a custom tab library? Presumably you have an event or callback for whenever the tab changes? That's where you would call the code Kevin suggested.
Allan
You need to place it in the
modExcl()
function where you are changing tabs. See the updated example:http://live.datatables.net/niradika/2/edit
Also you need to create unique id's for each table for the
$.fn.dataTable.tables()
call to work. Otherwise it will only find the last table with sameid
.Kevin
dang you're good!!! Thanks that does the trick