Example: Hiding a view row when unflagging

Last updated on
30 April 2025

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: