Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.
This repository was 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

Description

@eugene-tea

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions