Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - Hack to preserve cell order #98

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion addon/components/ember-collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,16 @@ export default Ember.Component.extend({
style = this._cellLayout.formatItemStyle(itemIndex, this._clientWidth, this._clientHeight);
cell = new Cell(itemKey, item, itemIndex, style);
cellMap[itemKey] = cell;
this._cells.pushObject(cell);
}

// hack to keep things in the correct order
var cells = [];
for (i=0; i < count; i++) {
itemIndex = index+i;
itemKey = decodeEachKey(items.objectAt(itemIndex), '@identity');
cells.push(cellMap[itemKey]);
}
set(this, '_cells', cells);
this._cellMap = cellMap;
},
actions: {
Expand Down
2 changes: 1 addition & 1 deletion tests/dummy/app/templates/percentages.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<hr />
<div class="mixed" style="position:relative;height:500px;">
{{#ember-collection items=model estimated-height=800 estimated-width=1000 buffer=10 cell-layout=(percentage-columns-layout model.length columns 50) as |item index|}}
<div class="list-item">
<div class="list-item" tabindex=0>
{{item.name}}
</div>
{{/ember-collection}}
Expand Down