Is there a method to fetch root node id?

Cheers.

Probably there is no such method.
Do you mean the ID of topmost item, or ID of virtual root item ( which is 0 by default ) ?

I am looking to get the id of the root node(top most item)

The top parent item has 0 id by default. It can be redefined via the 4th parameter of Tree construtor or the first parameter of attachTree method.

If the question is about the id of the first visible node, you can use the following:

var id = tree.getItemIdByIndex(0,0);

Here the first parameter is parent id (0 in this case), the second - index of the item in a branch.