mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(collectionRepeat): always render data correctly with before/after isblings
Closes #2025
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user