DataTables / Responsive

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

`not-` classes cannot be combined #55

Open Philzen opened 8 years ago

Philzen commented 8 years ago

Fiddle

Studying the documentation for responsive class logic and also from several use cases i had the assumption that classes are freely combinable. For example, in the fiddle the "Company Name" field will always be shown within tablet and mobile breakpoints by adding mobile tablet in the class attribute.

When using not-*, it turns out the functionality breaks when trying to combine them. As you can try out in the fiddle, removing one of the two on the "Description" class-Attribute will work as expected, using two or more not--classes makes the column behave as if all was set.

This behaviour is inline with my understanding what happens around this area - basically one cancels out the other:

https://github.com/DataTables/Responsive/blob/master/js/dataTables.responsive.js#L425

imho (as this is also a reversed logic) this could be changed to be subtractive, rather than adding all other breakpoints to the includeIn array.

DataTables commented 8 years ago

Very good point - this should work, and that it doesn't is absolutely a bug.

I'm not immediately certain what the fix should be - as you point out the rest of the logic is additive, and mixing that the subtractive logic that should be used for the not-* case might be a little messy.

I'll get back to you on this one when I get a chance to look at it a bit closer. Unfortunately it won't be included in the next release of Responsive (since that should be tomorrow).