Questions tagged [backbone-views]

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.

Docs

1114 questions
0
votes
1 answer

How should Backbone listen for file upload?

I wrote a single button file upload using a hidden iframe and javascript to submit the form. I'm trying to get backbone to listen for when it is successful so I can create a new div for the image to be inserted onto the page but I am fairly new to…
user965749
  • 45
  • 7
0
votes
1 answer

How can you suppress click events of # hrefs?

I would like to auto suppress click events when the link href is a hash (#). I don't want to have to stop the event with e.preventDefault() within each view. How can you stop click events application wide for # hrefs?
imrane
  • 1,542
  • 2
  • 16
  • 29
0
votes
1 answer

How do I unbind the default view event bindings?

I have a collection which is rendered by a Backbone Marionette item view. The view is being re-rendered whenever the collection is reset. As far as I can work out, that is default Backbone.Marionette behaviour. Is there a way I can disable it? var…
David Tuite
  • 22,258
  • 25
  • 106
  • 176
0
votes
2 answers

backbone.js each collection in view

If I loop the collection in the view, it's seems empty, alert dialog don't show up. When I use console.log(this.collection) in this view, it's look ok (16 element in this collection). My router: (collection url: '/api/employees', this is a rails…
0
votes
1 answer

Backbone: Singleton views?

I got several different views which are mostly built up like (layout-component, layout, main view). When I now switch between different views the whole page has to get rerendered. Wouldn't it be better to cache at least the layout view in "window"…
bodokaiser
  • 15,122
  • 22
  • 97
  • 140
0
votes
1 answer

How to get information from a view to a model in Backbone.js without a DOM event

I'm new to Backbone.js and am having trouble figuring out the proper architecture for a model-view relationship. I have a view that holds an input box and a model that is supposed to take the contents of that input box and send it to the server. My…
Chris Dutrow
  • 48,402
  • 65
  • 188
  • 258
0
votes
1 answer

Re-render backbone view when fetching collection with add:true parameter

I have backbone collection and under some circumstances I am fetching more models into the collection with: collection.fetch({data: {...}, add: true}); I need view of the collection to be re-rendered when new members arrive. "reset" event is not…
Boffin
  • 570
  • 2
  • 7
  • 21
0
votes
1 answer

Backbone, one field not set when calling view.render after model.save

I have the following problem. On a user-event (click on .twitterDefault) I call save event with twitter : { handle : handle, ignore : false } Then the success function gets called and I set fields on the…
forste
  • 1,103
  • 3
  • 14
  • 33
0
votes
2 answers

Binding View Methods to Dynamically Change View's HTML Class

var foo = Backbone.View.extend({ tagName: 'div', className: 'unselected', events: { 'click div' : 'select' }, initiate: function () { ._bindall(this, 'render' , 'select' ); this.render(); }, render: function () { …
Asher G.
  • 4,903
  • 5
  • 27
  • 30
0
votes
2 answers

How to clean views and models in Backbonejs

movieDb.Router = Backbone.Router.extend({ routes:{ '': 'landPage', 'home': 'landPage', 'login': 'login', 'signup': 'signup' }, landPage: function(p){ …
Barry
  • 1,587
  • 2
  • 13
  • 19
0
votes
1 answer

Unable to reference Backbone model after model.set in Backbone View

I'm trying to get the view to self render by binding a change event to the views model. I've created a custom function on PageView which takes a model from the Pages collection as a paramater and uses this.model.set(data) to trigger the model change…
James Parker
  • 2,095
  • 3
  • 27
  • 48
0
votes
1 answer

Backbone view not rendering correctly on subsequent calls to route handler

I'm having a problem with rendering a backbone.js view successfully from a route handler (browser application). My javascript module is currently setup like this: $(function () { // DOM ready myModule.Init(); }); var myModule = (function ()…
Bob Yexley
  • 2,704
  • 4
  • 24
  • 35
0
votes
2 answers

Parameters for render method in Backbone View

I'm using this coffeescript code: in a spec file: index = new MeetingIndex(render: false, collection: booking.meetings) index.render(writeTo: '.sandbox') in the view file: render: (options = {}) -> console.log 'options' console.log options …
sites
  • 21,417
  • 17
  • 87
  • 146
0
votes
1 answer

Backbone.js Task App how should grouped view look like

I am developing a task app in Backbone.js for FUN and one of feature is grouped view. Grouped view will display tasks that are grouped according to their done status. Currently i can construct the grouped object from the collection. Constructing the…
Deeptechtons
  • 10,945
  • 27
  • 96
  • 178
0
votes
1 answer

Collection models is empty on console.log

I have a problem with collections in backbone.js, I'm doing something wrong. This is my Model var Point = Backbone.Model.extend({ defaults: { x: 0.0, y: 0.0, z: 0.0, }, validate: function(attrs) { …
originof
  • 795
  • 1
  • 7
  • 24