mkhairi / jquery-datatables

Jquery datatables ruby gems for assets pipeline
https://datatables.net/
Other
75 stars 18 forks source link

More than one datatable per page looks broken #15

Open Ana06 opened 5 years ago

Ana06 commented 5 years ago

This is how my second table looks like using responsive:

image

mkhairi commented 5 years ago

hi @Ana06, this issue may related with you css grid or something else.

Ana06 commented 5 years ago

css grid? I don't think so, because the css is the same for the two tables and only the second one looks broken.

This is where I am using it: https://github.com/openSUSE/open-build-service/blob/master/src/api/app/views/webui2/webui/user/_involvement.html.haml

mkhairi commented 5 years ago

@Ana06, owh just noticed your datatables in bootstrap tabs.
We need to call [responsive.recalc()](https://datatables.net/reference/api/responsive.recalc()) as well so Responsive also knows about the change

$('a[data-toggle="tab"]').on('shown.bs.tab', function (e) {
      console.log( 'show tab' );
      $($.fn.dataTable.tables(true)).DataTable()
          .columns.adjust()
          .responsive.recalc();
 });