So I have this TreeView/TreeStore, which I fill with data from a list. My application uses only said list as reference data. The TreeStore is just constructed for display. And the TreeView can be resorted by tipping the column headers. Because .set_sort_column_id() was used for initialization of each column.
Problem is, following code always returns the clicked row number in the display:
# convert ListStore iter to row number
def rowno(self):
(model, iter) = self.MY_LIST_STORE.get_selection().get_selected()
return model.get_path(iter)[0]
It's supposed to do that. This works fine for me as long as the original unsorted list is displayed. Once the TreeView (and TreeStore?) is resorted, the displayed row numbers (.get_path) no longer correspond to the row numbers in my original data store.
How can I map this? Or how can I find out which selected path number corresponds to which entry in the originally passed TreeView list?
(Of course, I could insert a faux column into the TreeStore to keep my original row number. But there must be some kind of native way to achieve it?)