Thanks a lot Ben.
I updated my code according to your comments.
But, I am still stuck with one small problem. ;-(
I can now expand the nodes as i want but when it collapsing and bring the tree to its original state.
I am not able to do it.
I have attached a fiiddle here
Can you please help me with this.
Looking forward for your reply