Skip to content

Update children view._index when reordering#2579

Closed
bogdanb wants to merge 1 commit intomarionettejs:masterfrom
bogdanb:patch-1
Closed

Update children view._index when reordering#2579
bogdanb wants to merge 1 commit intomarionettejs:masterfrom
bogdanb:patch-1

Conversation

@bogdanb
Copy link
Copy Markdown

@bogdanb bogdanb commented Jun 3, 2015

Without this change, the CollectionView will not react upon moving a child view back immediately after it was reordered.

Example: when creating a view for collection [a, b], the views will have indexes [va.0, vb.1]. If we switch the order to [b, a], the views will retain their indexes while changing their position, i.e. [vb.1, va.0]. (The view is correctly reordered.) If we then switch the order again to [a, b], the test in _sortViews() will think that the order has not changed, and the views will remain in positions [vb, va].

(Depending on the situation, a call to _updateIndices() might fix this.)

Without this change, the CollectionView will not react upon moving a child view back immediately after a change. 

Example: when creating a view for collection [a, b], the views will have indexes [va.0, vb.1]. If we switch the order to [b, a], the views will retain their indexes while changing their position, i.e. [vb.1, va.0]. (The view is correctly reordered.) If we then switch the order again to [a, b], the test in _sortViews() will think that the order has not changed, and the views will remain in positions [vb, va]. 

(Depending on the situation, a call to _updateIndices() might fix this.)
@ahumphreys87
Copy link
Copy Markdown
Member

thanks for the PR @bogdanb this has already been fixed here: ahumphreys87@e787839

It is pending release of 2.4.2 which is very close. You can track its progress here: #2532

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants