Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Detecting deselecting a row in a ui.ListDataSource
-
A table view has the following two delegate methods defined
def tableview_did_select(self, tableview, section, row): # Called when a row was selected. # this is implemented in ListDataSource pass def tableview_did_deselect(self, tableview, section, row): # Called when a row was de-selected (in multiple selection mode). # this is NOT implemented in ListDataSource... pass
It looks as though the ListDataSource object only implements the first one, so I am not able to determine when multiple selection is enabled in edit mode, after the user may select and deselect any rows, what rows remain selected.
Has anyone come across this issue before?
class ListDataSource(builtins.object) | Methods defined here: | | __init__(self, items=None) | Initialize self. See help(type(self)) for accurate signature. | | reload(self) | | tableview_accessory_button_tapped(self, tv, section, row) | | tableview_can_delete(self, tv, section, row) | | tableview_can_move(self, tv, section, row) | | tableview_cell_for_row(self, tv, section, row) | | tableview_delete(self, tv, section, row) | | tableview_did_select(self, tv, section, row) | | tableview_move_row(self, tv, from_section, from_row, to_section, to_row) | | tableview_number_of_rows(self, tv, section) | | tableview_number_of_sections(self, tv) | | ---------------------------------------------------------------------- | Data descriptors defined here: | | __dict__ | dictionary for instance variables (if defined) | | __weakref__ | list of weak references to the object (if defined) | | items
-
The listdatasource source code is pure python. You can extend it, and implement the deselect method, or else just monkey patch it in.
-
Extending it worked perfectly. Thanks