Tag: backbone.js

Loading fullcalendar events from a backbone collection breaks the next & previous functions

noob coder here. I’m having trouble linking fullcalendar to backbone.js. My problem arises when I use the ‘previous’ and ‘next’ buttons on fullcalendar to navigate. Here is the bug: I make a new event. The event shows up on the calendar. I press ‘next’. I press ‘previous’. The new event has disappeared. It looks like […]

Weird view attribute result in backbone

I have a view in backbone and I would like to create some attributes. I did that: var ProgrammeDetailsView = Backbone.View.extend({ $infoResult: $(‘#info-result’), $castingResult: $(‘#casting-result’), $broadcastResult: $(‘#broadcast-result’), $testResult: $(‘#test’), […] And I surprisely got this result: console.log(this.$infoResult); -> Array { selector=”#test”, forEach=forEach(), reduce=reduce(), more…} As you can see, I’ve used “this.$infoResult” which should return an […]

backbone.relational – key, keySource, keyDestination

I have the following two models: User and Job. Each user can have just one job. The user.attributes and job.attributes look like these (1): (1) user.attributes = { id: 1, name: ‘barName’, job_id: 5 } job.attributes = { id: 5, name: ‘fooJob’ } Let’s suppose I want to make a relation between these two models: […]

Using functions to manage relationships in Backbone

I am working (for the first time) with Backbone.js in creating a reasonably simple application. I am currently working with two entities that have a one-to-many relationship: Project: has many groups Group: belongs to one project I looked at a few different ways of representing relationships between models, from Backbone’s own recommendations to Ligament to […]

Backbone.js – Back button (window.history.back) with label of the previous page

I’d like to display a back button with a label related to the previous page (a title or something like this) which will be called on the click event. I currently use the window.history.back() function on the event but how could I get the label ?

How do I upload an image using the Parse.com javascriptSDK?

I’m using Parse.com to build a javascript app, and I need to upload photos. I have a form which allows users to select the image on their filesystem, but what do I do with it next? I can’t find any documentation for this on the Parse site (not for the javascriptSDK, anyway). Thanks for any […]

Removing first View and Creating a second View (backbone.js)

I am working on the following feature: When a user clicks on a photo on the page, a modal modalView appears with more details of that item. In modalView, the user can click on the photo of another item, which will close the first modal window modalView and open a new modal window modalView containing […]

Blur on hidden element doesn't remove focus

I Use Chrome Version 21.0.1180.89 I have an input that i .hide() and call .blur() on. the blur event is fired, the input is not actually losing focus. Is this documented behavior? Is there a good workaround? I am building a Backbone app where data in a textfield should be saved when the user press […]

Backbone collection not has no such method has each

I have a backbone collection that fetch some data but when I try to iterate over the collection using the each method it get Object [object Array] has no method ‘each’ Here is the model for the collection: define ([‘backbone’],function(Backbone){ return Backbone.Model.extend({ url:’http://some_url/api/post/’, }); });//end define The collection itself: ‘ define ([‘backbone’,’models/Post’],function(Backbone,Post){ return Backbone.Collection.extend ({ […]

Variable dependency in RequireJS

I’m using RequireJS to load my JavaScript modules for a BackboneJS web app, but I’m running into a style issue at the moment. I have two classes that share a LOT of code, but they both subclass different classes. TemplateLessonView LessonView | | | | EditorApp <– these share code –> MainApp Now to keep […]