Skip to content

Commit 120f99e

Browse files
committed
fix(collectionRepeat): always render data correctly with before/after isblings
Closes #2025
1 parent beecc62 commit 120f99e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

js/angular/service/collectionRepeatDataSource.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,13 @@ function($cacheFactory, $parse, $rootScope) {
8181
attachItemAtIndex: function(index) {
8282
if (index < this.dataStartIndex) {
8383
return this.beforeSiblings[index];
84-
} else if (index > this.data.length - 1) {
85-
return this.afterSiblings[index - this.data.length - this.dataStartIndex];
84+
}
85+
// Subtract so we start at the beginning of this.data, after
86+
// this.beforeSiblings.
87+
index -= this.dataStartIndex;
88+
89+
if (index > this.data.length - 1) {
90+
return this.afterSiblings[index - this.dataStartIndex];
8691
}
8792

8893
var item = this.getItem(index);

js/angular/service/collectionRepeatManager.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ function($rootScope, $timeout) {
106106
primaryPos = secondaryPos = 0;
107107
previousItem = null;
108108

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

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

0 commit comments

Comments
 (0)