UI-related richselect is a non-editable combo-box.
Visually, the richselect control consists of a text input and popup window that contains a standard list of options in its body.
Another possibility to create a component with a similar functionality is attaching a suggest list to a text field, but in this case, text field will be editable.
// full form
{
view:"richselect",
id:"list2",
label:"richselect",
value:1,
yCount:"3",
options:[
{id:1, value:"One"}, // the initially selected item
{id:2, value:"Two"},
{id:3, value:"Three"}
]
}
// short form for options array
{view:"richselect", options:["One", "Two", "Three"]}
// server options
{ view:"richselect", options:"server/data.json"}
Related sample: Non-editable Combo Box ('richselect')
Richselect control can be customized in a number of ways, e.g.:
You can customize the default suggest list configuration, learn more in the Advanced Settings of Popup Selectors article.
Richselect API provides a set of techniques for getting popup and list objects for further usage. The examples below illustrate available options:
$$("richselect1").getPopup(), // getting the suggest
$$("richselect1").getPopup().getBody(), // getting the actual body of the suggest
$$("richselect1").getPopup().getList(), // getting the list object
$$("richselect1").getList(), // getting the list object, a short way
In the Webix Pro edition the control can be extended to show either a DataView or DataTable in the popup:
In case of a full initialization form, the getValue() method for richselect will return ID of selected option rather than text. Use getText() method to get text value.
$$("field_t").getValue(); // ->returns 1
$$("field_t").getText() // -> returns "One"