Example: Hiding a view row when unflagging
Last updated on
30 April 2025
You are browsing documentation for an older version of Drupal, which is not supported any longer, and the information may not be correct. See current documentation for Contributed modules
A question:
is it possible to hide the whole view row when unflagging?
Yes. Use this code:
(function ($) {
$(document).bind('flagGlobalAfterLinkUpdate', function(event, data) {
if (data.flagName == 'tasks' && data.flagStatus == 'unflagged') {
if ($(data.link).parents('.view-taskslist').size()) { // Are we inside the view?
$(data.link).parents('tr').hide('slow');
}
}
});
})(jQuery);
We assume that the flag name is "tasks" and the view's machine-name is "taskslist".
You may also be able to do this with the Flag Classes module (but it has no support for animation (yet)).
Help improve this page
Page status: Not set
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion