jquery Programming Glossary: model.get
Turning your jQuery code into a Backbone.js structure http://stackoverflow.com/questions/11967378/turning-your-jquery-code-into-a-backbone-js-structure term.toLowerCase return this.filter function model return model.get 'question' .toLowerCase .indexOf term 1 var QuestionController.. this. el.html render function var html '' if this.model.get term html p start typing a question p else if this.model.matches.length.. else this.model.matches.each function model html ' p ' model.get 'question' ' p ' this. el.html html Bring models and views..
BackboneJS Rendering Problems http://stackoverflow.com/questions/12004534/backbonejs-rendering-problems function attr _this. '.model ' model.cid ' ' attr .html model.get attr render the complete template should only happen when..
Integrating JSON feed with Backbone JS http://stackoverflow.com/questions/5629972/integrating-json-feed-with-backbone-js addStatusList function model #status .prepend div model.get 'status' div var appview new AppView jQuery PHP server code.. addStatusList function model #status .prepend div model.get 'status' div var appview new AppView jQuery script body html.. this.status.each function model statusEl.prepend div model.get 'status' div var appview new AppView Full HTML part 2 DOCTYPE..
Turning your jQuery code into a Backbone.js structure http://stackoverflow.com/questions/11967378/turning-your-jquery-code-into-a-backbone-js-structure model Question matches function term if term return term term.toLowerCase return this.filter function model return model.get 'question' .toLowerCase .indexOf term 1 var QuestionController Backbone.Model.extend defaults term initialize function.. this.render deactivate function this. el.removeClass 'active' this. el.html render function var html '' if this.model.get term html p start typing a question p else if this.model.matches.length 0 html p No match p else this.model.matches.each.. p else if this.model.matches.length 0 html p No match p else this.model.matches.each function model html ' p ' model.get 'question' ' p ' this. el.html html Bring models and views together Instantiate bind events and run things var questions..
BackboneJS Rendering Problems http://stackoverflow.com/questions/12004534/backbonejs-rendering-problems model.changedAttributes attrs _.keys changes _.each attrs function attr _this. '.model ' model.cid ' ' attr .html model.get attr render the complete template should only happen when there really is a dramatic change to the view render function..
Integrating JSON feed with Backbone JS http://stackoverflow.com/questions/5629972/integrating-json-feed-with-backbone-js new Status status post.status this.status.add statusModel addStatusList function model #status .prepend div model.get 'status' div var appview new AppView jQuery PHP server code which returns in json format this works fine php getQuery HTTP_GET_VARS.. new Status status post.status this.status.add statusModel addStatusList function model #status .prepend div model.get 'status' div var appview new AppView jQuery script body html Thank you for your time. Julien's code. StatusList Backbone.Collection.extend.. this.status.value render function var statusEl #status this.status.each function model statusEl.prepend div model.get 'status' div var appview new AppView Full HTML part 2 DOCTYPE html html head title JSON Test title head body input value..
|