How to get rows ids in treegrid: root rows only and all rows

Hi everybody
I have two questions regarding getting rows ids methods in treegrid:

  1. How to get only rows ids of root items (the very top level only)
  2. How to get all rows ids (including rows that are hidden in collapsed parent rows)

Unfortunately I cannot find appropriate methods in api to solve these tasks.

Thanks in advance for any help

I found solution :bulb:
My problem was that I did not know that for the root items in treegrid ParentRowId = ‘0’. It is assigned by default at treegrid initialization.
I found it in the source code of treegrid.
Now both my questions may be easily solved if to take into account that ParentRowId = ‘0’:
var RootItemsIds = treegrid.getSubItems(‘0’);
var AllItemsIds = treegrid.getAllSubItems(‘0’);