In the dat.gui interface, there is a dropdown list that allows users to select a number. Once a number is chosen, the jumpSwitcher will correspond to that number. The goal is to replace each list with items specific to the number chosen for Starsystem
.
https://i.sstatic.net/POqEf.png
For example, when the number 2 is selected, the list will show
solPlanets= ['Ilos', 'Tuchanka', 'Illium', 'Palaven']
. However, by default, the list displays ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune'] because the default jumpSwitcher value is 1.
The issue arises when the list always displays
solPlanets= ['Mercury', 'Venus', 'Earth', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune']
, regardless of whether the jumpSwitcher is set to 2.
Although an alert message pops up when jumpSwitcher is set to 2, indicating that the value has changed, the list does not update. This issue is likely related to dat.gui not refreshing properly. Despite attempting the listen() method, suggested as the solution, it has not resolved the problem.
A fiddle has been created to demonstrate the issue.
PS: A previous question was asked regarding this matter, but it seems the problem lies with dat.gui failing to refresh values, rather than a JavaScript issue. Therefore, the previous question was deleted as it was targeting the wrong audience, and a fiddle was not provided at that time.