Is there any way I can show/hide entire column in Views Table?
Exclude from Display completely excludes the column which is not possible to show again, so, I am using Views Dynamic Fields Module to exclude the column initially and showing it when the filter is checked. Like in the picture, the initial view when Column is hidden using Views Dynamic Fields module.
When the Nick Name checkbox is checked the column is shown like:
However, I want to hide the Name Column entirely when Nick Name is shown.
I initially tried it with jQuery like:
// Hide the Name Column when Nick Name is shown
$('#edit-dyfield-field-girls-nickname').change(function() { // id of checkbox
if ($('#edit-dyfield-field-girls-nickname').is(':checked')) {
$('.views-field-title').hide(); // Title points to Name field so all the th td have this class in Name
}
});
But it hides both Name and Nick Name for a while, and shows both fields again.
Any solution Drupal based or some tricks with jQuery/JavaScript would be fine, thank you.