How to get checked rows ids without expanding the row

I have the problem to get checked rows from a tree grid. The row has child rows.It is nearly 4000 records. When ever i click the parent , the child row also get checked automattically. i have done this.
But i unable to collect the checked row ids including child ids without expanding the tree. How to collect all the checked Row Ids without expanding the tree? kindly help me. Please.