Don't add on click events on dialog open

Instead add them once during setup

This fixes an issue where click events would fire x amount of times
depending on how many times the dialog was opened and closed, on even
times sort would run twice and not toggle.