DataTables / Responsive

Responsive extension for DataTables, providing support for complex tables on all device screen sizes
Other
148 stars 86 forks source link

Bug clearing the search field & using Savestate the table is not resized correctly #111

Open lenamtl opened 5 years ago

lenamtl commented 5 years ago

Hi,

When using savestate and responsive there is an issue when clearing the search value as it is not resize / display the table correctly.

To reproduce http://jsfiddle.net/lenamtl/nm5k1ro3/3/ search for Jane click back button of your browser, then get back to Jsfiddle clear the search value Now the table is not displayed correctly

If you refresh the page this is ok. This is not happening if you don't quit the page and clear the search field. So this should be the same when we quit and go back then clear the search field.

As a temporary solution I'm looking for a way to attach a page reload when clearing the search field https://datatables.net/forums/discussion/comment/143193#Comment_143193

colin0117 commented 5 years ago

Duplicate of this thread - https://datatables.net/forums/discussion/53223/responsive-issue-with-clear-search-and-savestate#latest

lenamtl commented 5 years ago

In fact, I posted my question first on forum and found out that this is a bug and this should be addressed to the dev...

lenamtl commented 5 years ago

The problem occurred also when using the pagination...

More info on how to reproduce: When doing a search and the result have different column size from the page load, let say some column have less text then the search result have different data (so the column width are different) and this cause is not resized correctly.

or let say on page one you have small text in column then on next page you have one column with more content it's not resized correctly too.

Here is a temporary solutions

to fix the problem on search

table14.on('search.dt', function() {
      table14.columns.adjust();
      table14.responsive.recalc();
 });

to fix the problem when using pagination

table14.on('page.dt', function() {
     table14.columns.adjust();
     table14.responsive.recalc();
 });