Get the original row number from .get_model () and .get_path () after accessing the TreeView

So, I have this TreeView / TreeStore, which I populate with the data from the list. My application uses only the specified list as reference data. TreeStore is just made for display. And TreeView can be used by overturning column headings. Because .set_sort_column_id () was used to initialize each column .

The problem is this: the code always returns the click number on 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]

He must do it. This works fine for me as long as the original unsorted list is displayed. After using TreeView (and TreeStore?), The displayed line numbers ( .get_path) no longer correspond to the line numbers in my original data store.

How to do it? Or how can I find out which selected path number corresponds to which entry in the originally submitted TreeView list?

(Of course, I could insert a faux column in the TreeStore to keep my original row number. But should there be some native way to achieve it?)

+3
source share
1 answer

, , PyGTK. , , Filterable. , , . , PyGTKHelpers , .

+2

Source: https://habr.com/ru/post/1765447/


All Articles