Forum Archive

Mode does not work allows_multiple_selection_during_editing

avv

Give me an example of working with the regime!

ccc
import ui

def make_table_view():
    tv = ui.TableView()
    tv.allows_multiple_selection_during_editing = tv.editing = True
    tv.data_source = tv.delegate = ui.ListDataSource('One Two Three Four Five'.split())
    return tv

class MultipleSelectionView(ui.View):
    def __init__(self):
        self.tv = make_table_view()
        self.add_subview(self.tv)
        self.present()
        self.tv.frame = self.bounds

    def get_selections(self):
        return [self.tv.data_source.items[row] for (_, row) in self.tv.selected_rows]

view = MultipleSelectionView()
view.wait_modal()
print(view.get_selections())
avv

Thank you for a good example! Congratulations to all a Happy New Year!