Get the correct ids when the rows are clicked