getSelectedId

returns the selected elements' ids

object|array|string getSelectedId(boolean asArray,boolean asString);

Parameters

asArraybooleanoptional, specifies whether the returning result should be array
asStringbooleanoptional, specifies whether the returning result should be string

Returns

object|array|stringcell/row/column id or array of them

Example

//return ids as an array of objects
grid.getSelectedId(true);
 
//return ids as an array of strings
grid.getSelectedId(true, true);

Details

If no parameters were passed to the method, it returns the id as an object (for one selected element) or as an array of objects (for several elements).

The format of the selection result if the second parameter (asString) is false:

{ column:"votes", row:4, id:4 } // "row" selection

where:

  • column - the column id
  • row - the row id
  • id - string value of the ID (the same as if you pass asString)

If the "asString" parameter was set, the result value depends on the selection mode:

  • "row" or true - 4 (as in dataset)
  • "column" - "votes"
  • "cell" - "4_votes"
See also
Back to top
If you have not checked yet, be sure to visit site of our main product Webix ui component library and page of javascript datagrid library product.