jquery - Getting Backbone,JS to load more than one Collection into a single View? -


i have little bit of issue, not sure if not understand or if trying not possible. have database loads text, simple plan text on 2 different pages, home , about.

now trying load data / text editable div (contenteditable set true) using backbone.js underscore.js template.

var textview = backbone.view.extend({     el: $(".loader"), //template loader placeholder     render: function() {         var = this;         var abouttxt = new aboutcollection(); //get page text         var hometxt = new homecollection(); //get home page text         abouttxt.fetch({             success: function(abouttxt) {                 var basictxt = _.template( $('script.basictext').html(), { abouttxt: abouttxt.tojson() } ); //load text template                 that.$el.html(basictxt)             }         });     } //end of render view function }); 

so main question is, can load more 1 collection view, or should / load more 1 url collection?

each of collections have point different url gets php return database data, json encoded, backbone.

so best method or doing this, or misunderstanding it?

thanks

all welcome.

update

these collections

    var homecollection = backbone.collection.extend({     url: 'basictext/home' });  var aboutcollection = backbone.collection.extend({     url: '/basictext/about' }); 

i don't current have models set, know works, if setup view use each of these collections. aim use 1 view load both of these collections. 1 collection getting 2 url's json encoded database data?

thanks.

    var model = backbone.model.extend({         urlroot: './url_to_json',         initialize: function() {                         this.about = new collection();                         this.about.url = urlroot + '/about';         }        }),      collection = backbone.collection.extend({         model: model,     url: './url_to_json'     }) 

hope you


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -