Datatables on-the-fly resizing

后端 未结 12 2191
灰色年华
灰色年华 2020-12-12 16:21

I\'m using the marvellous DataTables jQuery plug-in; http://datatables.net/ Added the FixedColumns and KeyTable extras.

Now the table does resize prettily when the

12条回答
  •  北海茫月
    2020-12-12 16:53

    The code below is the combination of Chintan Panchal's answer along with Antoine Leclair's comment (placing the code in the windows resize event). (I didn't need the debounce mentioned by Antoine Leclair, however that could be a best practice.)

      $(window).resize( function() {
          $("#example").DataTable().columns.adjust().draw();
      });
    

    This was the approach that worked in my case.

提交回复
热议问题