Using backbone.js in my first product, what I learned

by Cedric Dugas on February 7, 2012 in Helping Guides with No comments Tweet

This week I launched an online wedding planner called WeddingDeck. Weddingdeck has backbone in it’s heart. There has been ups and downs while using it, and I wanted today to talk about a couple of stuff that happened to me along the road.

Defining your structure

There is no predefined structure shipped with backbone. Much like jQuery in fact, you kind of have to make your own. Personally I would prefer if there was a preferred structure explained… Read the rest

jQuery Mobile and backbone.js, the ugly

by Cedric Dugas on January 30, 2012 in Helping Guides with 3 Comments Tweet

jQuery Mobile is a great technology, no doubt it can be an integral part of the future like jQuery is today. However even if the 1.0 version is out after more than a year after the alpha has been launched, it still feels like a very young product. There is enough posts and beginner tutorials around the web about the greatness of jQuery mobile. But not so much about the hurdles of jQuery mobile integrated in other systems. Let’s dive… Read the rest

Optimizing the views list creation with document fragment

by Cedric Dugas on January 2, 2012 in Helping Guides with 8 Comments Tweet

Before using backbone when working with a list of html nodes I always made it my duty to append them only in one big chunk of text. Manipulating the dom is slow, it triggers a reflow of the page, this is costly even on small lists, specially on mobile.

So being not sure what I should be doing I decided to append each view directly in my container like this.

  var jqGuestList 

… Read the rest

There is no magic behind backbone.js model.isNew()

by Cedric Dugas on December 19, 2011 in Helping Guides with No comments Tweet

model.isNew() can be quite useful, this method can be interesting when handling and changing forms behaviors from adding new items, to updating and deleting them. At first I did not quite understand how isNew() was working internally and, one day it just stopped working and that was frustrating!

It’s all about the id

One thing I like to do is prepopulate my fields with defaults values. Backbone has a great feature for that, when instantiating a model you can pass… Read the rest

Getting started with web mobile using backbone

by Cedric Dugas on December 19, 2011 in Helping Guides with No comments Tweet

Just found out a nice article about getting started from scratch on mobile using backbone.js. While normally I would not advocate rolling your own “framework”. I feel like mobile doesn’t need much to get going (at least with droids and iphone) and it can be a good thing to learn how that work since mobile is probably going to be a big part of the future.

Here a part of the article and the link:

Let’s make a collective… Read the rest

Backbone.js walkthrough of Models and Views (Part 2/2)

by Cedric Dugas on December 15, 2011 in Screen Casts with No comments Tweet

Backbone.js walkthrough of Models and Views

by Cedric Dugas on December 15, 2011 in Screen Casts with No comments Tweet

Handling “variable is not defined” with underscore template engine

by Cedric Dugas on November 29, 2011 in Helping Guides with 2 Comments Tweet

One of the cool thing with backbone.js is that you can plug in about any javascript templating engine there is. Also another nice extra is that there is one already bundled with underscore.js that is quite powerful.

Personally the template engine provided with underscore cover most of my use cases and is enough for me, but there is one thing that I have found very unpleasant, you cannot pass undefined keys to it. Here an example:

var template

… Read the rest

Modifying your urls on the fly using the request method with sync in backbone.js

by Cedric Dugas on November 14, 2011 in Helping Guides with 1 Comment Tweet

Yeah that’s a long title, Backbone provides one default url for all your types of request with your models. But what if you want to be able to change your url model that is synching with your api depending of the type of request? Well that’s what we are here to do.

Backbone Sync

Sync is a nice utility used by backbone when you request your server to sync your model. Each time your request a change, backbone call sync,… Read the rest

Working with api responses in backbone.js using parse

by Cedric Dugas on November 9, 2011 in Helping Guides with No comments Tweet

One backbone.js behavior that was kind of upsetting me recently is the fact that it re-syncs your model after you save it on the server.

You know, you just set a model you changed, save it on the server in the background and continue your day in your application. Backbone however awaits patiently the response from the server api, and if the response does not correspond with your current model state, it sets the response attributes back to your… Read the rest

← Older Entries
 
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.