Extract method refactor of onClick

The implementation of the two portions of the `if` statement were the same.  This pulls that into a common function that can be used directly to in case someone needs to programmatically set the filter values.

Note, `onClick` did not have any direct tests, so I wasn't sure how I should proceed with that.  All current tests still pass, so assuming they have adequate indirect coverage of `onClick`, this should be ok.