Question

Here is a sample fiddle in which there is Google visualization category picker control. I am trying to reset the selected values of category picker as,

function dashboardReady() {
      // reset the category picker when clicked.
    document.getElementById('resetButton').onclick = function() {
      categoryPicker.setState({'categoryPicker.getState().selectedValues' : 'none'});
      categoryPicker.draw();
    };
  }

using a button <button style="margin: 2em" id="resetButton">Reset</button>. How to reset it correctly?

Was it helpful?

Solution

You can use setState() to set initial values:

    var reset = document.getElementById('resetButton');
    reset.addEventListener('click', function() {
        categoryPicker.setState({selectedValues: ['CPU', 'Memory']});
        categoryPicker.draw();
    }, false);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top