From 0155d57861259e9da4b96d9648ef51c9d40be11d Mon Sep 17 00:00:00 2001 From: Oliver Hamlet Date: Thu, 13 Nov 2014 22:26:24 +0000 Subject: [PATCH] Reset list scrolling when changing game. --- resources/report/js/script.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/resources/report/js/script.js b/resources/report/js/script.js index ad984eb9..530a7a62 100644 --- a/resources/report/js/script.js +++ b/resources/report/js/script.js @@ -576,8 +576,18 @@ function changeGame(evt) { loot.game.masterlist = gameInfo.masterlist; loot.game.globalMessages = gameInfo.globalMessages; loot.game.plugins = gameInfo.plugins; - document.getElementById('cardsNav').querySelector('core-list').data = loot.game.plugins; - document.getElementById('main').querySelector('core-list').data = loot.game.plugins; + + /* Reset virtual list positions. */ + document.getElementById('cardsNav').lastElementChild.scrollToItem(0); + document.getElementById('main').lastElementChild.scrollToItem(0); + + /* Now update virtual lists. */ + document.getElementById('cardsNav').lastElementChild.data = loot.game.plugins; + document.getElementById('main').lastElementChild.data = loot.game.plugins; + + /* Update the list sizes to take into account data changes. */ + document.getElementById('cardsNav').lastElementChild.updateSize(); + document.getElementById('main').lastElementChild.updateSize(); } catch (e) { console.log(e); console.log('changeGame response: ' + result);