javascript - Infinite scroll js with backbone -


I am constantly stuck with this issue for 3 days, I used to scroll in my spine project I am trying.

I tried to find an answer to my question with the search engine but I was unable to do this, I am the initiator developer with backbone.js .

View item list:

  var ItemList = Backbone.View.extend ({initialize: Function () {}, render: function () {this. $ El .empty (); this.collection.each (function (_itemData) {var itemList = new item view ({model: _itemData}); $ .append (itemList.el);}, this);}}) ;   

View of item list views:

  render: function () {var _itemList = _template (ItemListTem); . This $ el.html (_itemList); Var _itemObj = Find _item.getItem (this.options.key); Var itemcallions = new item collection (_itemObj); Var itemListView = new item list ({archive: item collation, L: '.itemListContainer'}); ItemListView.render (); });   

Item collection:

  var itemCollection = backbone.collection.extend ({Model: itemModel, url: RootWebsite});   

And I divided the item list and item template into separate HTML files.

Item list template:

  & lt; Div class = "itemListContainer" & gt; & Lt; / Div & gt; & Lt; Script & gt; $ (Document) .ready (function () {$ ('#empan itam'). Infinitiuscroll ({navSelector: "#next: last", next selector: "one # next: last", item selector: "#appendItem p "Debug: True, loading IMG:" / img / loading .gif ", loading text:" Loading new post ... ", animate: right, donation:" I think we reach the end Gone ", adend callback: wrong, path: [" http: // localhost / website / # itemlist "]}, function (jason, ops) {var page = opts.state.currPage;})}}; & lt ; / Script & gt;   

item template:

here ->

console.log (opts.scur.currPage) Page no. 1,2,3 Increase ... when scrolling arrives at the corner of windows and it has no effect on the list of my view.

I wonder, do I have to add more to the collection, or how to scroll Separate complete data in small size

I'm sorry if I'm a little late! Welcome to your question and thank you for any help with my problem, you can provide me!

This time you renders everything itemView.render (), accept it index parameters, and share the archive

  Render: function (index) {//this.$el.empty (); Var Load Elements = Index * 10; _ (This.collection.models.splice (Load Elements, Load Elements +10)) each (function (_itemData) {var itemList = new item view ({model: _itemData}); $. El.append (itemList.el ); },this); }   

Then your plug-in should be rendered

 }, function (Jason, Opts) {var page = opts.state.currPage; ListView.render (page-1) // You said that it starts with 1});   

});

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -