Using table().container()
Using table().container()
jclopmel
Posts: 2Questions: 1Answers: 0
Hello,
I try to use Datable for first time in my code, and I can't handle the "table().container()" API function.
At first I create the datatable and I load the data from a PHP server. My problem is that I'd like to "addClass()" to the main container #products_datatable_wrapper, but I am not able, any suggestion would be quite helpful.
Here ir a summary of my js code:
var table = $('#products_datatable').DataTable( {} );
$( table.table().container()).addClass('p-0');
Thanks a lot!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @jclopmel ,
I tried and it seems OK for me - see this screenshot:
Can you show us an example please of how it's failing for you?
Cheers,
Clin
I'd like but I can't show the real code because it's protected and I haven't privileges enough to do it. In any case, now I know it works for you, I'm sure I'm doing something wrong. I already tried the same but with "drawCallback", and it does work fine. I don't know the difference among them.
Thanks a lot!
I'm surprised
table().container()
doesn't work, it doesn't really do much.drawCallback
is called every time the table is drawn - so after the page is changed, a sort applied, etc. Therefore, it won't be efficient, but at least you're moving!C