Drop-down Lists

The [dropdown] section adds a drop-down list to the widget header to reload the data or to change the chart appearance.

[dropdown]
  options = nurswgvml006, nurswgvml007, nurswgvml010
  change-field = series.entity

The drop-down list can be configured to update a setting at the [widget], [series] or [property] levels such as the entity or metric name.

The options can be enumerated manually, passed from a collection or loaded from the server.

Settings

Name Description
change-field Name of the setting changed upon drop-down list selection.
To update a setting at the section level, use <section-name>.<setting-name> syntax.
Examples:
change-field = type
change-field = series.entity
on-change If specified, field is evaluated instead of default onchange behavior.
Either onchange, or change-field is required for any drop-down list.
Example: on-change = widget.reload();
format Format applied to the option value if no option text setting is specified.
Example: format = value.toUpperCase()
style CSS style applied to the HTML element of the drop-down list.
Example: style = max-width: 125px

Options

Populate the list of options with the options setting or as an array of [option] fields.

Options Syntax

  • Comma-separated list:

    options = opt1, opt2, opt3
    
  • Placeholder to a list:

    list tag_list = /opt, /home, /mnt
    ...
    options = @{tag_list}
    
    csv hosts = NAME,LOCATION
    ...
    endcsv
    
    options = @{hosts.values('NAME')}
    

    If the list contains elements with a comma, use the escape() method to escape commas:

    options = @{tag_list.escape()}
    
  • [option] array:

    [option]
      value = opt1
    [option]
      value = opt2
    [option]
      value = opt3
      text = Option 3
    

Examples

Change Widget Type

[widget]
  type = bar

/* this drop-down modifies widget type on change
the list of displayed options is specified in options field */
[dropdown]
  options = Chart, Bar, Gauge
  change-field = type

[series]
  metric = cpu_busy
  entity = nurswgvml007

Change Property Type

[dropdown]
  on-change = widget.post.queries[0].type = this.value; widget.reload();
  change-field = property.type
  options = configuration, jfs, system, network  

[property]
  type = configuration

Change Metric, Entity, or Both

[dropdown]
  change-field = series.metric
  options = cpu_user, cpu_system, cpu_busy
[dropdown]
  change-field = series.entity
  options = nurswgvml007, nurswgvml006

Replace Series

[dropdown]
  options = nurswgvml007, nurswgvml006, nurswgvml010
  on-change = replaceEntityInSeriesCollection(cpu_series, this.value); cpu_widget.replaceSeries(cpu_series);  replaceEntityInSeriesCollection(disk_series, this.value); disk_widget.replaceSeries(disk_series);