Skip to content

Commit

Permalink
fix(collectionRepeat): always render data correctly with before/after…
Browse files Browse the repository at this point in the history
… isblings

Closes #2025
  • Loading branch information
ajoslin committed Aug 20, 2014
1 parent beecc62 commit 120f99e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions js/angular/service/collectionRepeatDataSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,13 @@ function($cacheFactory, $parse, $rootScope) {
attachItemAtIndex: function(index) {
if (index < this.dataStartIndex) {
return this.beforeSiblings[index];
} else if (index > this.data.length - 1) {
return this.afterSiblings[index - this.data.length - this.dataStartIndex];
}
// Subtract so we start at the beginning of this.data, after
// this.beforeSiblings.
index -= this.dataStartIndex;

if (index > this.data.length - 1) {
return this.afterSiblings[index - this.dataStartIndex];
}

var item = this.getItem(index);
Expand Down
2 changes: 1 addition & 1 deletion js/angular/service/collectionRepeatManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ function($rootScope, $timeout) {
primaryPos = secondaryPos = 0;
previousItem = null;


var dimensions = this.dataSource.dimensions.map(calculateSize, this);
var totalSize = primaryPos + (previousItem ? previousItem.primarySize : 0);

Expand Down Expand Up @@ -310,6 +309,7 @@ function($rootScope, $timeout) {
renderItem: function(dataIndex, primaryPos, secondaryPos) {
// Attach an item, and set its transform position to the required value
var item = this.dataSource.attachItemAtIndex(dataIndex);
console.log(dataIndex, item);
if (item && item.element) {
if (item.primaryPos !== primaryPos || item.secondaryPos !== secondaryPos) {
item.element.css(ionic.CSS.TRANSFORM, this.transformString(
Expand Down

0 comments on commit 120f99e

Please sign in to comment.