Skip to content

getSelectedId

returns the selected elements ids

function getSelectedId(
// optional, specifies whether the returning result should be an array
asArray?: boolean,
// optional, specifies whether the returning result should be a string
asString?: boolean
): object|array|string

object,array,string a cell/row/column id or an array of them

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

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”

Articles

API