Stores the selection value in the state object of the tree.