Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter, destroy, re-initialize issues #741

Closed
noslouch opened this issue Jun 14, 2014 · 2 comments
Closed

Filter, destroy, re-initialize issues #741

noslouch opened this issue Jun 14, 2014 · 2 comments

Comments

@noslouch
Copy link

Hey There!

I've found something of an edge case that crops up in Backbone when moving between views. I imagine this will come up in Ember or other libraries/frameworks as well.

Test case: http://codepen.io/noslouch/debug/dEosa

If you filter an isotope layout, then destroy the isotope instance (i.e. move to another view), then reinitialize isotope (i.e. return to the view containing the isotope instance), isotope will not initialize and behave as expected.

The expected behavior is that it should initialize with the original options and all items should be visible. The actual behavior is it seems to initialize with only what's originally visible, but I'm not exactly sure what's happening.

@desandro
Copy link
Member

Thanks for digging into this one. Looks like display was not being reset after destroy. Adding this code will resolve it:

var Item = Isotope.Item;
var _destroy = Item.prototype.destroy;
Item.prototype.destroy = function() {
  // call super
  _destroy.apply( this, arguments );
  // reset display, #741
  this.css({
    display: ''
  });
};

See http://codepen.io/desandro/pen/xjzyJ

This will be added in the next version of Isotope

@noslouch
Copy link
Author

Sweet! I had a similar workaround in a callback I implemented. Glad to see it in the core 🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants