javascript - How to display only 3 items from my backbone collection -
I got new in m backbone and I got stuck with this issue for my collection 3 items are required to display and display after clicking and displaying 3 other of them. I know I can use for example
before ()
method underscore.js
but how? This is my code:
$ (function () {var function = backbone.model.edended (); var task list = backbone.collection.example ({model: work, url: ' JS / Data.json '}); var View Workbench = Backbone View.Extension ({AL: "# Task", Template: _Template ($ (' # Task Title ') .HTML ()), Render: Function ( } {_.each (this.model.models, function) {var workTemplate = this.template (tasks.toJSON ()); $ (this.el) .append (taskTemplate);}, this); ;}}}; Var function = new worksheets (); var workspace = Wins = new workspace ({model: function}); function; fate ({reset: true}); work; bid ('reset', function () {tasksView.render ();});});
You can use underscores first
method. That it helps
var taskbar view = backbone.View extensions ({AL: '# Task', Template: _.template ($ ('# taskemplate') .html () ), Start: Function () {this.listenTo (this.collection, 'reset', this.render);}, render: function () {_.each (this.collection.first (3), function (function) {Var html = This.template (task.toJSON ()); $ El.append (html);}, this); It returns back;}} var = task = new task list (), tasksView = new task view ({archive: function}); Tasks.fetch ({reset: true});
Comments
Post a Comment