Views in the Backbone.js library. Backbone views are used to reflect what your applications' data models look like. They are also used to listen to events and react accordingly.
Questions tagged [backbone-views]
1114 questions
8
votes
1 answer
Understanding Backbone and Marionette View lifecycle
I'm new to this world and I need to understand some of the concepts of Backbone and Marionette. Here I'm trying to explain some of the concepts I'm learning. It would be great to having some feedback on them.
The render function defines the logic…

Lorenzo B
- 33,216
- 24
- 116
- 190
8
votes
1 answer
Understanding layouts in Marionette for Backbone.js
I think I may have a fundamental misunderstanding of how Marionette.Layout is intended to be used.
I'm trying to something like this:
The layout includes two Marinotette.ItemViews: The "Explode" ItemView and the "PopStar" ItemView. This layout is…

Chris Dutrow
- 48,402
- 65
- 188
- 258
8
votes
2 answers
Event fires twice
I'm declaring a View like this:
var VirtualFileSelectorView = Backbone.View.extend({
selected: function() {
console.log("selected function");
},
initialize: function() {
// Shorthand for the application namespace
…

marcus
- 9,616
- 9
- 58
- 108
7
votes
1 answer
How does the new Backbone View 'events' hash work with function values instead of strings in version 0.9.0?
The Backbone 0.9.0 changelog says:
A view's events hash may now also contain direct function values as
well as the string names of existing view methods.
When I try the following it fails, saying that the value for the event is undefined.
var BB…

aw crud
- 8,791
- 19
- 71
- 115
7
votes
1 answer
MarionetteJS: Application Regions vs. Layouts
I was reading the documentation of the latest version (2.3.0) and it is saying that Application Regions are now deprecated.
Application Regions
Warning: deprecated This feature is deprecated. Instead of using the
Application as the root of your…

Abe
- 6,386
- 12
- 46
- 75
7
votes
3 answers
Backbone.View: Swapping out two child views that share an element in the parent view
Note: I understand that other libraries (e.g., Marionette) could greatly simplify view-based issues. However, let's assume that that is not an option here.
Let's say that we have a parent view for a given "record" (i.e., a model). That parent view…

EleventyOne
- 7,300
- 10
- 35
- 40
7
votes
1 answer
How to attach Backbone.Marionette view to existing element without creating extra element
Say I have these two Backbone.Marionette views:
var FooView = Backbone.Marionette.ItemView.extend({
tagName: p,
id: 'foo',
template: this.templates.summary
});
var BarView = Backbone.Marionette.ItemView.extend({
template:…

T Nguyen
- 3,309
- 2
- 31
- 48
7
votes
1 answer
Backbone View inheritance - call parent leads to recursion
I have a three Backbone View class inheritance:
var preventRecursion = 0;
var parentView = Backbone.View.extend({
initialize: function(){
console.log('parentView');
}
});
var nestedChildView = parentView.extend({
initialize:…

Erik
- 14,060
- 49
- 132
- 218
7
votes
1 answer
Need help understanding the basics of nested views in backbone
I've been doing a bunch of reading about nested views in backbone.js and I understand a good amount of it, but one thing that is still puzzling me is this...
If my application has a shell view that contains sub-views like page navigation, a footer,…

Charles
- 309
- 1
- 16
7
votes
2 answers
Showing, Hiding, then re-showing Layouts breaks Events
Having trouble showing, hiding, and then re-showing Marionette Layouts. I believe this problem also applies to regular Backbone Views and Marionette ItemViews as well though.
In summary, I have a parent view. When it is initialized, it creates two…

Chris Dutrow
- 48,402
- 65
- 188
- 258
7
votes
1 answer
Backbone view, initialize and render
I have a backbone view which load subview. When I load a subview, I would like to show a loader when the view fetch needed datas and hide the loader when the view is ready to render.
I did something like this :
var appView = Backbone.View.extend({
…

Mickael
- 5,711
- 2
- 26
- 22
6
votes
1 answer
React.js: Bind to Existing Elements
In Backbone.js, you can specify a view's element by using the el property or by calling view.setElement().
Is there an equivalent way of hooking up a React.js component to an existing DOM element?

cantera
- 24,479
- 25
- 95
- 138
6
votes
3 answers
Catching remove event on View in Backbone js
Is there any way to listen to remove/destroy event on the Backbone View.?
I want to do some thing like as below:
$(myBackboneView).on('remove', function () {
// do some processing
});
or
$(myBackboneView).on('destroy', function () {
// do…

Rahul Bhanushali
- 553
- 5
- 14
6
votes
2 answers
Backbone.js: Routing for nested views
I'm trying to figure out following scenario:
Lets say that I have two views: one for viewing items and one for buying them. The catch is that buying view is a sub view for viewing.
For routing I have:
var MyRouter = Backbone.Router.extend({
…

Fdr
- 3,726
- 5
- 27
- 41
6
votes
2 answers
One modal rendering different templates when clicking on a element
I have different buttons (one for creating a 'sprint', another for creating a comment, etc). The forms for doing these tasks are appended to a modal dialog that is displayed when you click on the different buttons.
These are the flows:
click on…

mikey-mike
- 25
- 4