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
0
votes
1 answer
Backbone.js - View not reloading
So I've managed to figure out how to populate my collection from an external file, and render a view based on a url, but I'm running into a problem. The code below is working as intended, except on page load, I'm getting the following…

Brian
- 49
- 1
- 4
0
votes
2 answers
Delegating events
I've got a backbone view for an entire collection (a list of "clickable" categories). Can I delegate events on each item of the view so that I can find which category has been clicked?

Alex Epelde
- 1,679
- 1
- 15
- 16
0
votes
1 answer
Two Views, One Model - How to handle fetch errors for both?
I have one model that is shared between 2 views.
I want to have an error attached to the fetch method that displays an error in both views.
But if I do model.fetch({error:...}), that error would only refer to one view
What is the best way to go…

imrane
- 1,542
- 2
- 16
- 29
0
votes
2 answers
Using jquery custom widgets with backbone.js views
I have a custom jQuery widget that is being called from my app that uses backbone.js for MVC. How can I use the backbone events pattern in my custom jQuery widget?
function( $ ) {
$.widget( "medex.chooser", {
...
_create: function() {
//…

Ramya
- 289
- 6
- 17
0
votes
1 answer
el is undefined when event fires
I trigger an event from one view like this:
select: function () {
// Shorthand for the application namespace
var app = brickpile.app;
// Trigger the selected event
app.trigger('selected', this.model);
}
and binds to the same event…

marcus
- 9,616
- 9
- 58
- 108
0
votes
1 answer
What's so special about the special options for Backbone.js View?
According to backbone.js doc for View:
There are several special options that, if passed, will be attached
directly to the view: model, collection, el, id, className, tagName
and attributes.
I understand the el,id & className are used for…

Henry
- 32,689
- 19
- 120
- 221
0
votes
1 answer
How to structure an application for creating items into a list with Backbone.Marionette?
This in one of the thing that still confuses me using Marionette.
Imagine a simple interface for viewing a list of comments and making a new comment. The way I'm structuring this currently is with a CommentApp like I have included below.
I guess…

David Tuite
- 22,258
- 25
- 106
- 176
0
votes
2 answers
_.bindAll function
My question most likely requires a very simple answer, which, nevertheless, I was not able to easily find.
A Backbone application I am working on has several views. When defining the different views, I use _.bindAll in the initialize function to…

AndraD
- 2,830
- 6
- 38
- 48
0
votes
1 answer
Backbone view event atacched to all views
I'm doing my first application in backbone and i get a strange thing happening trying to attach an event.
I got this code so far:
//View for @girl, EDIT action
GirlEditView = Backbone.View.extend({
initialize: function(el, attr) {
…

nax
- 1,184
- 1
- 8
- 19
0
votes
1 answer
The best way for extending a model
According the Backbone.js documentation Model-parse does the following:
parse is called whenever a model's data is returned by the server, in
fetch, and save.
To augment models I've already loaded I use Model.parse(). I accomplish this by using…

antonjs
- 14,060
- 14
- 65
- 91
0
votes
1 answer
Backbone.js rendering a reset collection with a single view
I'm trying to render a filtered collection from a single view using a select box using the reset property. First issue is that the select box and the rendered content must all appear in the same div in order to work. Is this normal? Second issue, is…

Teeman
- 23
- 6
0
votes
1 answer
Rendering and delete multiple views…
I hope i am clear enough, otherwise ask me for clarifications.
I would like to delete end create view in agreement to a main template…
I did try the following implementation, unsuccessfully.
// main-template.html

underscore666
- 1,719
- 4
- 24
- 37
0
votes
1 answer
Backbone collection remove, ReferenceError: el is not defined
I have a view for a collection, and when I invoke its remove method I call its collection remove method as well, and I'm getting a 'ReferenceError: el is not defined' which doesn't make any sense to me, why would a collection need an el.
Invoking…

orlybg
- 599
- 1
- 5
- 15
0
votes
1 answer
Click event not firing
I've looked around for a while now and have not been able to find anything that suggests what the cause of this is.
My code:
var faqView = Backbone.View.extend({
tagName: 'div',
id: 'faq-list',
initialize: function() {
var view…

Nalum
- 4,143
- 5
- 38
- 55
0
votes
1 answer
Backbone.js: Model events are not fired while used within a Collection
Here I have a Backbone.js Model - Contact and a Collection - Contacts with Contact as the Model. I've two views where in one I use collection to list all the contacts and in the second the model directly to show a single contact. But when I'm using…

Saneef
- 8,620
- 7
- 29
- 42