Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

CollectionView insert new rows in opposite order to backbone collection models #891

Open
eugenet8k opened this issue Sep 8, 2016 · 0 comments

Comments

@eugenet8k
Copy link

It seems there is a little bug in CollectionView. If I add to Collection array of models, like:

  models = [{a:'1'}, {a:'2'}, {a:'3'}, {a:'4'}]
  collection.add models, at: 5

The new item views will be created in CollectionView but the order of added items will be reversed. This is because of this line in CollectionView:

  # When an item is added, create a new view and insert it.
  itemAdded: (item, collection, options) =>
    @insertView item, @renderItem(item), options.at

options.at has the original value 5, so all items will insert in this position, where it should insert into position of options.index which has the proper position of newly added model in the whole Collection.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant