Dynamically build tree sort menu when sort menu is selected