updaing javascript tree