diff --git a/src/strand-grid/strand-grid.html b/src/strand-grid/strand-grid.html index 8764158b..c9a714ef 100644 --- a/src/strand-grid/strand-grid.html +++ b/src/strand-grid/strand-grid.html @@ -19,7 +19,7 @@ - + @@ -36,7 +36,7 @@ - + Loading... diff --git a/src/strand-grid/strand-grid.js b/src/strand-grid/strand-grid.js index f6698e44..d1537810 100644 --- a/src/strand-grid/strand-grid.js +++ b/src/strand-grid/strand-grid.js @@ -44,6 +44,9 @@ type: Boolean, value: false }, + _measuring: { + type: Boolean, + }, expanded: { type: Boolean, value: false, @@ -269,6 +272,10 @@ } }, + _showLoader: function (isLoading, _measuring) { + return isLoading; + }, + requestInitialization: function () { return this.$.viewport.initialize(); }, diff --git a/src/strand-item-recycler/strand-item-recycler.js b/src/strand-item-recycler/strand-item-recycler.js index 23fa2ffb..b607e34e 100644 --- a/src/strand-item-recycler/strand-item-recycler.js +++ b/src/strand-item-recycler/strand-item-recycler.js @@ -52,7 +52,9 @@ found here: https://github.com/Polymer/core-list //Initialize scrollTop to supplied index itemRecycler.async(itemRecycler.scrollToIndex); } - itemRecycler.toggleAttribute("measuring", false, itemRecycler.$.middle); + if (itemRecycler._initialized) { + itemRecycler._setMeasuring(false); + } } else if (itemRecycler._itemHeight < 0) { change = itemRecycler._accommodateGlobalHeightAdjustment(0|!initialization, bound, delta); itemRecycler.async(itemRecycler._modifyPadding, 1); @@ -236,6 +238,13 @@ found here: https://github.com/Polymer/core-list return new Continuum(this._getItemHeight.bind(this)); }, }, + measuring: { + type: Boolean, + value: false, + notify: true, + readOnly: true, + reflectToAttribute: true, + }, data: { type: Array, value: null, @@ -552,7 +561,7 @@ found here: https://github.com/Polymer/core-list }, _needsInitialization: function (data, _templateFound) { - this._initializable = false; + this._initializable = true; this._initialized = false; this.initialize(); }, @@ -563,13 +572,14 @@ found here: https://github.com/Polymer/core-list } else if (!this.hasTemplate()) { return 0|false; } else { - this.debounce("initializeRecycler", this.initializeRecycler); + this._setMeasuring(true); + this.debounce("initializeRecycler", this.initializeRecycler, 1); return 0|true; } }, initializeRecycler: function() { - if (!this._initializable) { + if (this._initializable) { if (this._recycler.truncate(0)) { this._scrollTop = 0; this.$.pane.scrollTop = 0; @@ -580,12 +590,16 @@ found here: https://github.com/Polymer/core-list this._measurements.terminate(0); - this.toggleAttribute("measuring", true, this.$.middle); - this._initializeViewport(); - this._initializable = true; + this._initializable = false; this._initialized = true; + + if (!this.data || + !this.data.length) { + this._setMeasuring(false); + } + return 0|true; } else { return 0|false; @@ -812,7 +826,7 @@ found here: https://github.com/Polymer/core-list if (place < this._maxPixels) { this._repositionBound(bound); - this.debounce("rebase-transform", this._rebaseTransform, 250000); + this.debounce("rebase-transform", this._rebaseTransform, 250); } else { this._rebaseTransform(); } diff --git a/src/strand-item-recycler/strand-item-recycler.scss b/src/strand-item-recycler/strand-item-recycler.scss index 03b8136c..b832633c 100644 --- a/src/strand-item-recycler/strand-item-recycler.scss +++ b/src/strand-item-recycler/strand-item-recycler.scss @@ -43,12 +43,12 @@ position: relative; } -#middle[measuring] { - visibility: hidden; -} - .recycler-panel { position: relative; } +:host([measuring]) #middle { + visibility: hidden; +} +