Comments (7)
Thanks Thomas, you are exactly right. I am working on the View Manager write now that controls the life cycle of views and stops zombie views, will be pushing in the next few hours. Thanks again!
from backboneboilerplate.
Hi,
I think it would be a nice improvement when we return 'this' on the render method.
ChildPage = Backbone.View.extend {
render: function() {
// do something
return this;
}
}
Sometime, from master page we want to append a child page, we could do:
childPage = new ChildPage()
$(element).append(childPage.render().el)
from backboneboilerplate.
I've also had issues with the current View Manager, which, while great, doesn't clean up properly. I came across this after loading views where events defined in (events.js) were being triggered multiple times. To work around this, I'm using undelegateEvents() on the previous view before creating a new one.
I'm aware that the VM isn't fully implemented yet, but any plans on setting this up?
from backboneboilerplate.
on second thought undelegateEvents is probably the only default cleanup a view manager should do and also calling clean() if it has been defined. What do you think?
from backboneboilerplate.
I'm certainly no expert, but that's just what I'm doing! Sounds good :)
Also, on the subject of VM - is it supposed to re-use already created views when called again? As currently, it doesn't seem to, and just creates a new view when create is called. In fact, views[name] is never defined.
Thanks for your quick response by the way!
from backboneboilerplate.
So in the view manager the views should always be created fresh, if you want to maintain a view you can do so using your applications logic.
Some goals I had for the view manager were
- clean up !important
- managing children / nested views
- a basic signalling of view creation to the app
- eventually more advanced event delegation e.g. the ability to make all event listeners on a view dormant etc
- handle dynamic reusable views such as table rows
For now I've changed the unbind() to undelegateEvents().
from backboneboilerplate.
Ok, that clears that up - sounds good. Thanks mate!
from backboneboilerplate.
Related Issues (20)
- problem with $.ajax call when overriding Backbone.sync in offline mode HOT 12
- Bootstrap? HOT 3
- Need more documentation and explanation of the View Manager
- I can't upgrade underscore & backbone HOT 1
- Use Lo-Dash instead of Underscore.js. HOT 4
- output visuals broken
- menu links '.active'
- Does not work with newest version of backbone.js(0.9.2) HOT 1
- Error... Module loading did not complete for HOT 1
- Small Request... HOT 1
- Typo in all views "intialize" instead of "initialize" HOT 1
- how to router.navigate ? HOT 2
- Using Lo-Dash v1.0.0
- View Transitions
- Upgrade to backbone 1.0?
- Minor layout bug
- All pages need padding-top: 4em on container
- Broken
- Can I use jQuery Mobile?
- Site Disabled
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from backboneboilerplate.