Restore functionality broken in pull request #245

It was necessary to leave the javascript as a function in the controller (albeit rewritten) as it is also needed by the charts module.

Fixed failure to act on item selection with root person drop down menu.