문제

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?

도움이 되었습니까?

해결책

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);
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top