Hanny94
Hanny94

Reputation: 125

Google Charts: How I can disable “Choose a value…” in controlType: CategoryFilter of ControlWrapper

I need know how disable "Choose a value..." in controlType: CategoryFilter of ControlWrapper

var categoryPicker = new google.visualization.ControlWrapper({
      'controlType': 'CategoryFilter',
      'containerId': 'control2',
      'options': {
    'filterColumnLabel': 'zone',
  'ui': {
      'labelStacking': 'vertical',
          'allowTyping': false,
          'allowMultiple': false,
          'caption' : 'All Zones'
        }
      },
  'state': {'selectedValues': ['']} // this don't solve my problem
    }); 

Is it possible to disable " choose a value" or here "All Zones"

Regard

Upvotes: 1

Views: 1247

Answers (1)

asgallant
asgallant

Reputation: 26340

Set the ui.allowNone option to false to force the user to select a value. By default, the control will be set to the first value in the list, unless you override with the state.selectedValues parameter:

var categoryPicker = new google.visualization.ControlWrapper({
    'controlType': 'CategoryFilter',
    'containerId': 'control2',
    'options': {
        'filterColumnLabel': 'zone',
        'ui': {
            'labelStacking': 'vertical',
            'allowTyping': false,
            'allowMultiple': false,
            'allowNone': false
        }
    },
    'state': {'selectedValues': ['Zone 2']}
});

Upvotes: 3

Related Questions