Closed alesnav closed 10 years ago
You can use the never
class in the very latest (unreleased at this time) code. There is a discussion about it here: https://datatables.net/forums/discussion/23409
Ok, then using classes and the nightly version of Responsive css and js:
http://live.datatables.net/wasugivi/2
You can see, column Position
has class never
and it is not shown, but you have the +
image anyway. When you click on +
button, nothing is displayed and you won't be able to click -
.
Nice Allan, good work! :)
Good point - thanks. I'll try to take a look at that later this week.
Fixed with commit cea1178f324 and the test case is working now: http://live.datatables.net/wasugivi/2/edit .
Thanks!
Yes, it does work now.
Thanks Allan!
I'm struggling to do this dynamically. The following adds the class, but the column still shows. I've tried triggering a draw()
, which is actually counter productive. Tips?
$header = jQuery($dt.column('col1:name').header());
$header.addClass('never'); // confirmed, never is in tacked onto the th
There isn't an option to dynamically add a class and have Responsive take that into account at the moment. Good suggestion though - I've added issue #21 for this feature.
hey @DataTables, idea. what if the api.columns(...).visibility(boolean) { ... } checks if responsive mode is enabled, and if so, applies 'never'
to the header such that the column hiding logic behavior is consistent with non-responsive tables? is that a reasonable solution?
Problem with that is that it would imply DataTables has to have knowledge of the plug-in, which it shouldn't. More of a problem is that Responsive actually uses column().visibility()
itself.
Having said that, it isn't an insurmountable problem using that method, a listener could look for column-visibility.dt
and if triggered externally, then the class could be added. That could be a neat solution - thanks for the suggestion.
So is the current status that dynamic tables using responsive can't have hidden columns?
No. Responsive 2 was rewritten not to use column().visibility()
. If you are having a problem with this, please open a new discussion in the forum with a link to a test case showing the issue.
Hello Allan,
I didn't see this nice plugin, so I will start using it :)
But I have a problem, I must hide some columns because those contain just codes/IDs and are not useful for users. When I enable responsive plugin, I can't hide these columns.
You can see this here (column name "Position" should be hidden): http://live.datatables.net/wasugivi/1
Thanks!
P.D.: sorting icons are not found when using default template in live.datatables.net: http://datatables.net/download/build/images/sort_both.png http://datatables.net/download/build/images/sort_asc.png http://datatables.net/download/build/images/sort_desc.png