-
Notifications
You must be signed in to change notification settings - Fork 281
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENYO-2533: Move deferred reset & refresh logic to VDR
NewDataList has some logic to defer refreshing and resetting when the list is not showing. This logic would apply equally to VirtualDataRepeater, so we'll move it there. Enyo-DCO-1.1-Signed-Off-By: Gray Norton (gray.norton@lge.com)
- Loading branch information
Gray Norton
committed
Sep 15, 2015
1 parent
8d78de3
commit 8c4f9ca
Showing
2 changed files
with
52 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,9 +25,15 @@ module.exports = kind({ | |
// reorderNodes: false, | ||
|
||
reset: function () { | ||
this.init(); | ||
this.destroyClientControls(); | ||
this.setExtent(); | ||
if (this.getAbsoluteShowing()) { | ||
this.init(); | ||
this.destroyClientControls(); | ||
this.setExtent(); | ||
this._needsReset = false; | ||
} | ||
else { | ||
this._needsReset = true; | ||
} | ||
}, | ||
|
||
init: function () { | ||
|
@@ -64,15 +70,38 @@ module.exports = kind({ | |
this.notify('numItems', pn, this.numItems); | ||
} | ||
}, | ||
|
||
refresh: function (immediate) { | ||
if (!this.hasInitialized) return this.reset(); | ||
|
||
this.stabilizeExtent(); | ||
refresh: function () { | ||
if (!this.hasInitialized) return this.reset(); | ||
|
||
this.doIt(); | ||
if (this.getAbsoluteShowing()) { | ||
if (arguments[1] === 'reset' && typeof this.collectionResetHandler === 'function') { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
graynorton
Member
|
||
this.collectionResetHandler(); | ||
} | ||
this.stabilizeExtent(); | ||
this.doIt(); | ||
this._needsRefresh = false; | ||
} | ||
else { | ||
this._needsRefresh = true; | ||
} | ||
}, | ||
|
||
/** | ||
* @private | ||
*/ | ||
showingChangedHandler: kind.inherit(function (sup) { | ||
return function () { | ||
if (this._needsReset) { | ||
this.reset(); | ||
} | ||
else if (this._needsRefresh) { | ||
this.refresh(); | ||
} | ||
return sup.apply(this, arguments); | ||
}; | ||
}), | ||
|
||
childForIndex: function(idx) { | ||
return this.childrenByIndex[idx]; | ||
}, | ||
|
Is there a reason you got rid of the argument and then used arguments[1]? Didn't want an unused arguments[0]? Also, I couldn't find any place (outside of old DataList) that indicates there could be more than one argument but it's not documented there so I'm not sure what role that plays.