peace_love
peace_love

Reputation: 6471

How can I fix my right column in jquery datatables?

In my datatable I fixed the right column

var table = $('.table').DataTable({
     "data":{{ data }},
     "scrollX": true,
     "fixedColumns":   {
        rightColumns: 1
      },

But when I change the amount of entries to show, or the pagination I get a strange display error.

I tried to solve the error like this:

"initComplete": function(settings, json) {
table.fixedColumns().relayout();

and also like this:

$('.table').on( 'draw.dt', function() {
    table.clear().draw();
  });

Upvotes: 0

Views: 756

Answers (1)

Alon Adler
Alon Adler

Reputation: 4024

Try to relayout on interval utilizing the fixedColumns().relayout() API

setTimeout(
  function()
  {
    $.fn.dataTable.tables( { visible: false, api: true } ).columns.adjust().fixedColumns().relayout();
  }, 1000);

Upvotes: 1

Related Questions