Reputation: 19880
I'm working on a web application which allows the user to edit elements on a page (much like you can do with Adobe InDesign). Objects can be dragged, selected and the user is provided with a sidebar which contains all properties of the object that can be modified.
The data is stored on the server in a database. I'm using Django with tastypie to provide a simple REST interface to the data in the database.
Basically the data is structured as follows:
I've done some tests with jQuery and jQueryUI, which provide most of the code needed to allow object selection, drag+drop, etc. All good.
Now I'm considering what the best way is to store/manage/pull/update the information about all those objects on the page. I could do it all by hand, and use jQuery.ajax()
and store information in arrays, dictionaries and link them to DOM elements. However, I feel there is quite a bit of reinventing the wheel and boilerplate code involved that could be avoided.
So I searched the web and came across Backbone.js. It reminds me a bit of Django's ORM and seemingly makes it simpler to manage all the data. As far as I understand the idea of Backbone.js it allows me to create a object class similar to that defined in the models on the server and use that to store all the information about an object.
Would it be suitable to use Backbone.js for this task? I've looked through its documentation and also saw it has support for doing the synchronization using REST/Ajax.
Upvotes: 1
Views: 616
Reputation: 9436
Backbone may be suitable for your needs because it does provide an abstraction for managing your data in a way that is not coupled to the DOM, namely through Backbone.Model
and Backbone.Collection
.
The Backbone Models and Collections make it easy to mange the communication with your backend by handling the AJAX life cycle. It also has useful conventions for doing things like client side validation and pub/sub around model attribute changes.
Another important thing to note is that Backbone is easy to use in a piecemeal fashion. You can take advantage of the Models concept and ignore the views/routers or just use it for event management, etc.
The documentation is quite good. Have a look.
Upvotes: 2
Reputation: 18133
You should consider ember.js is an excellent tool with no time manages to make an application (not trivial) for the generation of service quality surveys. and have done with emberjs appreciate. as it is the first time where he stayed php server side completely and not use it for more than the REST.
Also has excellent documentation and is very easy to extend.
Upvotes: 0