DataTables / Responsive

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

Part of header elemets are being cloned to the responsive column layout #46

Closed vedmack closed 9 years ago

vedmack commented 9 years ago

Hi,

When resizing the window so that some column change their display layout (instead of column its dispplayed in row) one of the element text (button text) is being cloned into the newly column layout.

See second table in the following showcase page. Steps to reproduce are: resize so one of the columns will be moved to the responsive layout and click on the (+) and notice that the column header is awarded with the x suffix (got it from the filter reset button). If there some pre column-visibility.dt event I could remove the column filter elements so that responsive wont clone some of them.

Or can it be solved in some other way?

Thanks.

https://github.com/vedmack/yadcf/issues/228

DataTables commented 9 years ago

Hi,

At the moment, what is happening is that the title is coming from $().text() which is run on the header cell for the column. That includes your x - hence the issue. This is the relevant code.

I recently came across a similar issue with Button's column visibility and had to revert it to use the DataTables internal title cache.

In the current release of Responsive there are two options:

In future versions of DataTables I need to include an API to get and set the header text. Until then, I think the correct thing to do will be for Responsive to use the same approach as Buttons. It isn't perfect, since it won't take account of any changes made in the header cell. But it is at least consistent.

The tricky part of DataTables will be getting and setting the title, while still allowing interactions such as this - I'll need to introduce a span element wrapper. v1.11

vedmack commented 9 years ago

Thanks alot @DataTables for the quick fix :)