Problem/Motivation

Whenever I delete the last item from my Favorites' list, I have to reload the page for the changes to be visible. It is prevented by an if statement in the rebuild function.

    rebuild: function(data) {
      if (data.list) {
        Drupal.detachBehaviors($('div#favorites-list'));
        $('div#favorites-list').html(data.list);
        Drupal.attachBehaviors($('div#favorites-list'));
      }
    },

Proposed resolution

Remove the if (data.list) statement. If the list is empty, it has to be rebuilt.

Comments

Babou’s picture

Here is a patch doing what I proposed above.

doitDave’s picture

Title: If statement in js prevent the list to be rebuilt after deleting the last element » List rebuild fails if resulting list is empty
Version: 7.x-1.x-dev » 7.x-2.x-dev
Assigned: Unassigned » doitDave

I have no idea why this issue did not show up in my views, apologies to @babou and also thanks a lot for your patience and your work!

  • 3c3cbf8 committed on 7.x-1.x
    #2169643 by Babou: Fixed flawed if-logic.
    

  • 568b86c committed on 7.x-2.x
    #2169643 by Babou: Fixed flawed if-logic.
    
doitDave’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.