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

@eugenet8k

Description

@eugenet8k

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.

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