AmpersandJS / ampersand-view

A smart base view for Backbone apps, to make it easy to bind collections and properties to the DOM.
http://ampersandjs.com
MIT License
92 stars 39 forks source link

Enhance docu about _upsertBindings() #180

Open DoomyTheFroomy opened 8 years ago

DoomyTheFroomy commented 8 years ago

After #105 has been successfully solved it is necessary to call this._upsertBindings() in the render function. Otherwise the view won't be rendered correctly after it has been removed. This happens mostly if you use a ampersand-view-switcher to handle your workflow and you have overridden the render function to do your own stuff. A better solution would be to generally call this._upsertBindings(), when render() is called, even if it is overridden.

cdaringe commented 8 years ago

Ah, difficult to believe this hasn't come up before. I thought we handled this case? Checkout _setRender. When you extend the view, we wrap it, call your new render, and do some other work. We could probably find a way in there to do the upsert in there and make you never have to worry about it. What do you think?

DoomyTheFroomy commented 8 years ago

@cdaringe this sounds good and looks like the right place, the same would be for _setRemove! I think you didn't came up before, because this case is very special, but if you like I could give you an example?!

cmazakas commented 7 years ago

I've had many issues with bindings in Ampersand. I've actually kind of just started writing my own bindings manually.

wraithgar commented 7 years ago

I believe once this PR is merged it will solve this issue https://github.com/AmpersandJS/ampersand-view/pull/181