Open 10erlosh opened 4 years ago
Did you try TableView#setSelectedRow(int)
?
@MGaetan89 yes, i did. It works fine but now i have another problem:
when performing sorting via onColumnHeaderClicked
the previously selected row gets un-highlighted and the column gets highlighted. How can this be prevented?
@Override
public void onColumnHeaderClicked(@NonNull RecyclerView.ViewHolder viewHolder, int column) {
tableView.setIgnoreSelectionColors(true); //experimental
tableView.sortColumn(column, tableView.getSortingStatus(column) == SortState.ASCENDING ? SortState.DESCENDING : SortState.ASCENDING);
adapter.getColumnHeaderRecyclerViewAdapter().notifyDataSetChanged();
tableView.setIgnoreSelectionColors(false); //experimental
}
Hi @10erlosh,
As far as I understand from your question, you want to unselect the selected rows after sorting process.
You can clear selection using the below line before sorting process;
tableView.getSelectionHandler().clearSelection()
After that, you can also select any of row using this;
tableView.setSelectedRow(row)
By the way, do these code snippets work?
Hi,
thanks for this great library! Is there a sane way to select the whole row
onCellClicked
andonRowHeaderClicked
?