evrencoskun / TableView

TableView is a powerful Android library for displaying complex data structures and rendering tabular data composed of rows, columns and cells.
MIT License
3.14k stars 459 forks source link

Wrong row number after sorting column or deleting row #241

Open sunyong00 opened 5 years ago

sunyong00 commented 5 years ago

After sorting column or deleting row, the row number in the TableViewListener.onCellClicked() callback is wrong. For example, for a table of 10 rows, if I delete row #5, the previous row #6 should become row #5. However, if I click on previous row #6, the row number is 6 instead of 5 in the onCellClicked() callback. I guess this could be due to CellRowRecyclerViewAdapter.mYPosition not being updated after sorting column or deleting row.

bedireray commented 5 years ago

Also selectionColors is coloring wrong line after sorting. Probably same issue cause this bug.

10erlosh commented 4 years ago

Any news on this bug?

Parlae commented 4 years ago

Having the same issue with sorting. Even when I sort column descending, the number of rows stay the same. I need to relate this row number to the index of the source data array but they get mismatched. Is there maybe a way to get cell ViewHolder for a given set of row/column coordinates similar to adapter().getCellItem(column, row)? This would solve my problem.

Parlae commented 4 years ago

Solved my question for referncing sorted cell value by using getAdapter().getCellRecyclerViewAdapter().getItem(row) which returns a list of Cell models. And all that is left to do is reference the one you need with .get(column).getData()