@@ -234,6 +234,7 @@ impl<'a, DataSource> DeferredTable<'a, DataSource> {
234234 let minimum_resize_size = ( style. interaction . resize_grab_radius_side * 2.0 ) + 2.0 ;
235235
236236 let mut clear_drag_state = false ;
237+ let mut request_row_selection_changed_action = false ;
237238
238239 // TODO allow these to be overridden
239240 let default_column_parameters = AxisParameters :: default ( ) ;
@@ -879,9 +880,12 @@ impl<'a, DataSource> DeferredTable<'a, DataSource> {
879880 if response. clicked ( ) {
880881 match cell_kind {
881882 CellKind :: RowHeader => {
882- match row_was_selected {
883- true => { temp_state. row_selections . remove ( & mapped_row_index) ; } ,
884- false => { temp_state. row_selections . insert ( mapped_row_index) ; } ,
883+ if self . parameters . selectable_rows {
884+ match row_was_selected {
885+ true => { temp_state. row_selections . remove ( & mapped_row_index) ; } ,
886+ false => { temp_state. row_selections . insert ( mapped_row_index) ; } ,
887+ }
888+ request_row_selection_changed_action = true ;
885889 }
886890 }
887891 // TODO selectable columns?
@@ -1169,6 +1173,19 @@ impl<'a, DataSource> DeferredTable<'a, DataSource> {
11691173 temp_state. drag_state = None ;
11701174 }
11711175
1176+ if request_row_selection_changed_action {
1177+ let potentially_visible_selections = temp_state
1178+ . row_selections
1179+ . iter ( )
1180+ . filter ( |& mapped_row_id| * mapped_row_id < dimensions. row_count )
1181+ . cloned ( )
1182+ . collect :: < BTreeSet < _ > > ( ) ;
1183+
1184+ actions. push ( Action :: RowSelectionChanged {
1185+ selection : potentially_visible_selections,
1186+ } ) ;
1187+ }
1188+
11721189 let repaint = match drag_action. take ( ) {
11731190 None => false ,
11741191 Some ( DragAction :: SetWidth ( index, new_width) ) => {
@@ -1195,7 +1212,7 @@ impl<'a, DataSource> DeferredTable<'a, DataSource> {
11951212 opaque_faint_bg_color : Color32 ,
11961213 opaque_faint_selected_bg_color : Color32 ,
11971214 ui : & mut Ui ,
1198- mut row_counter : usize ,
1215+ row_counter : usize ,
11991216 row_was_selected : bool ,
12001217 ) -> Color32 {
12011218 if row_was_selected {
@@ -1400,6 +1417,11 @@ pub enum Action {
14001417 from : usize ,
14011418 to : usize ,
14021419 } ,
1420+
1421+ /// Generated when the user selected or deselects one or more rows.
1422+ RowSelectionChanged {
1423+ selection : BTreeSet < usize > ,
1424+ } ,
14031425}
14041426
14051427#[ derive( Debug , Default , Clone , Copy , PartialEq , Eq , Hash , PartialOrd , Ord ) ]
0 commit comments