getSelectedId

returns the selected elements ids

object|array|string getSelectedId( [boolean asArray,boolean asString] );
asArraybooleanoptional, specifies whether the returning result should be an array
asStringbooleanoptional, specifies whether the returning result should be a string
object|array|stringa cell/row/column id or an 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 - the string value of the ID (the same as if you passed asString)

If the "asString" parameter is set, the result value will depend on the selection mode:

  • "row" or true - 4 (as in the 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.