Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1421)

Unified Diff: ui/webui/resources/cr_elements/network/cr_network_list.js

Issue 2627373002: MD Settings: Save and restore scroll position in iron-list (Closed)
Patch Set: Nits Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/webui/resources/cr_elements/network/cr_network_list.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/webui/resources/cr_elements/network/cr_network_list.js
diff --git a/ui/webui/resources/cr_elements/network/cr_network_list.js b/ui/webui/resources/cr_elements/network/cr_network_list.js
index 26cddbe00f8243d8b23fb4cc7900ac0129c72ebf..8dcce41d968d54ac4ff7aa3f07f8fba60e681ee4 100644
--- a/ui/webui/resources/cr_elements/network/cr_network_list.js
+++ b/ui/webui/resources/cr_elements/network/cr_network_list.js
@@ -21,7 +21,7 @@ Polymer({
type: Array,
value: function() {
return [];
- }
+ },
},
/**
@@ -32,7 +32,7 @@ Polymer({
type: Array,
value: function() {
return [];
- }
+ },
},
/** True if action buttons should be shown for the itmes. */
@@ -49,29 +49,35 @@ Polymer({
selectedItem: {
type: Object,
observer: 'selectedItemChanged_',
- }
+ },
+
+ /**
+ * Contains |networks| + |customItems|.
+ * @private {!Array<!CrNetworkList.CrNetworkListItemType>}
+ */
+ listItems_: {
+ type: Array,
+ value: function() {
+ return [];
+ },
+ },
},
behaviors: [CrScrollableBehavior],
- observers: ['listChanged_(networks, customItems)'],
+ observers: ['updateListItems_(networks, customItems)'],
/** @private */
- listChanged_: function() {
- this.updateScrollableContents();
- },
+ updateListItems_: function() {
+ this.saveScroll(this.$.networkList);
- /**
- * Returns a combined list of networks and custom items.
- * @return {!Array<!CrNetworkList.CrNetworkListItemType>}
- * @private
- */
- getItems_: function() {
var customItems = this.customItems.slice();
- // Flag the first custom item with isFirstCustomItem = true.
if (customItems.length > 0)
customItems[0].isFirstCustomItem = true;
- return this.networks.concat(customItems);
+ this.listItems_ = this.networks.concat(customItems);
+
+ this.restoreScroll(this.$.networkList);
+ this.updateScrollableContents();
},
/**
« no previous file with comments | « ui/webui/resources/cr_elements/network/cr_network_list.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698