Check documentation for the latest version of dhtmlxSuite getSelected DHTMLX Docs

getSelected

returns the currently selected ID

string|number getSelected(boolean as_array);
as_arraybooleantrue, to force the return value to be an array
string|numbercurrently selected id

Example

var id = myList.getSelected();

Details
  • if the multiselection is enabled and multiple items are selected, this method will return an array of IDs;
  • "as_array" parameter makes sense in multiselection mode, where a method may return a single value or an array based on selection state.

By using the "as_array" parameter you will always receive an array as the result of the method, which can simplify further processing.

Back to top