Generalize this somehow by allowing user to provide override for detecting whether a row is selected.