class YuiRestClient::Widgets::Combobox

Class representing a ComboBox in the UI. It can be YComboBox.

Public Instance Methods

editable?() click to toggle source

Allows to check if combobox is editable and allows setting . @return [Boolean] true if widget enabled, false otherwise. @example Check if combobox with id 'test' editable

app.combobox(id: 'test').editable? # true
# File lib/yui_rest_client/widgets/combobox.rb, line 90
def editable?
  property(:editable) == true
end
items() click to toggle source

Returns the list of items available to select from combobox. @return [Array<String>] array of strings. @example Get items from combobox with id “nfs_version”

{
  "class": "YComboBox",
  "debug_label": "NFS Version",
  "icon_base_path": "",
  "id": "nfs_version",
  "items": [
    {
      "label": "Any (Highest Available)",
      "selected": true
    },
    {
      "label": "Force NFSv3"
    }
  ],
  "items_count": 5,
  "label": "NFS &Version",
  "value": "Any (Highest Available)"
}

@example

app.combobox(id: 'nfs_version').items
# Any (Highest Available)
# Force NFSv3
# File lib/yui_rest_client/widgets/combobox.rb, line 32
def items
  property(:items).map { |x| x[:label] }
end
select(item) click to toggle source

Sends action to select the item in combobox. @param item [String] item to select in combobox. List of items can be retrieved from JSON “items”->“label” manually or by using 'combobox(filter).items'. @return [Combobox] in case action is successful @raise YuiRestClient::Error::ItemNotFoundInWidgetError in case value is not found in combobox. @example Select “Force NFSv3” item in combobox with id “nfs_version”

app.combobox(id: 'nfs_version').select('Force NFSv3')
# File lib/yui_rest_client/widgets/combobox.rb, line 43
def select(item)
  action(action: Actions::SELECT, value: item)
  self
end
set(value) click to toggle source

Sends action to set string to the editable combobox. @param item [String] value to set in the combobox. To check if combobox is editable, call editable? @return [Combobox] in case action is successful @raise YuiRestClient::Error::ItemNotFoundInWidgetError in case value is not found in combobox. @example Set “Custom Version” item in combobox with id “nfs_version”

app.combobox(id: 'nfs_version').select('Custom Version')
# File lib/yui_rest_client/widgets/combobox.rb, line 81
def set(value)
  action(action: Actions::ENTER_TEXT, value: value)
  self
end
value() click to toggle source

Returns selected item in combobox. @example Get selected item in combobox with id “nfs_version”

{
  "class": "YComboBox",
  "debug_label": "NFS Version",
  "icon_base_path": "",
  "id": "nfs_version",
  "items": [
    {
      "label": "Any (Highest Available)",
      "selected": true
    },
    {
      "label": "Force NFSv3"
    }
  ],
  "items_count": 5,
  "label": "NFS &Version",
  "value": "Any (Highest Available)"
}

@example

app.combobox(id: 'nfs_version').value
# File lib/yui_rest_client/widgets/combobox.rb, line 70
def value
  property(:value)
end