Unable to get root folder id without clicking or selecting any other folders

Hi,
There is a scenario like, If I don’t select any folder/subfolder I need to select root folder as defualt based on its Id.

Please help me.
Thanks in advance.

Next will return id of first top level item

tree.getFirstChildId(0);