Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix issues with nodes no longer be in the original container due to prio... #134

Merged
merged 2 commits into from

2 participants

@kriszyp

...r removal or loading node being gone, fixes #133

@SitePenKenFranqueiro
Collaborator

Works for me; reproducible before fix on JsonRest.html (e.g. error removing ID 24 or nothing appears to happen removing item 25; both remove fine after patch). Haven't noticed any regressions (e.g. in tree.html).

I'll ask Bryan if he wants to give this a shot before it's merged too, since he reported it.

@SitePenKenFranqueiro SitePenKenFranqueiro merged commit 1599804 into SitePen:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 22, 2012
  1. @kriszyp

    Fix issues with nodes no longer be in the original container due to p…

    kriszyp authored
    …rior removal or loading node being gone, fixes #133
  2. @kriszyp
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 5 deletions.
  1. +11 −5 List.js
View
16 List.js
@@ -387,7 +387,7 @@ function(arrayUtil, kernel, declare, listen, aspect, has, miscUtil, TouchScroll,
options = options || {};
var self = this,
start = options.start || 0,
- row, rows;
+ row, rows, container;
if(!beforeNode){
this._lastCollection = results;
@@ -401,10 +401,16 @@ function(arrayUtil, kernel, declare, listen, aspect, has, miscUtil, TouchScroll,
// remove from old slot
row = rows.splice(from, 1)[0];
// check to make the sure the node is still there before we try to remove it, (in case it was moved to a different place in the DOM)
- if(row.parentNode == (beforeNode ? beforeNode.parentNode : self.contentNode)){
+ if(row.parentNode == container){
firstRow = row.nextSibling;
- firstRow.rowIndex--; // adjust the rowIndex so adjustRowIndices has the right starting point
- self.removeRow(row); // now remove
+ if(firstRow){ // it's possible for this to have been already removed if it is in overlapping query results
+ firstRow.rowIndex--; // adjust the rowIndex so adjustRowIndices has the right starting point
+ self.removeRow(row); // now remove
+ }
+ }
+ // the removal of rows could cause us to need to page in more items
+ if(self._processScroll){
+ self._processScroll();
}
}
if(to > -1){
@@ -441,7 +447,7 @@ function(arrayUtil, kernel, declare, listen, aspect, has, miscUtil, TouchScroll,
return lastRow;
}
function whenDone(resolvedRows){
- var container = beforeNode ? beforeNode.parentNode : self.contentNode;
+ container = beforeNode ? beforeNode.parentNode : self.contentNode;
if(container){
container.insertBefore(rowsFragment, beforeNode || null);
lastRow = resolvedRows[resolvedRows.length - 1];
Something went wrong with that request. Please try again.