In an XPages application I am using Bootstrap modal and the datatables plugin. On the datatables website I have read to recalculate the responsiveness when loading the table in a Bootstrap modal e.g.:
var table = $('#example').DataTable();
$('#example').css( 'display', 'table' );
table.responsive.recalc();
Because I am working with XPages my ID's are dynamic So I have to call a helper function:
var table = x$('#{id:tableObj}').DataTable();
x$('#{id:tableObj}').css( 'display', 'table' );
table.responsive.recalc();
So my final code looks like:
x$('#{id:bootstrapModal}').modal('show');var table =
x$('#{id:tableObj}').DataTable();x$('#{id:tableObj}').css( 'display',
'table' );table.responsive.recalc();
id:tableObj
is the id of the xp:table
control that resides in a custom control.
The good thing is that it renders the first table in the dialog as a datatables table, but not responsive.
Another bad thing is that only the first table is rendered as a DataTables table, and not other tables (multiple custom controls in the dialog.
What am I doing wrong?