@@ -82,7 +82,6 @@ pub enum ScrollToRowMode {
82
82
}
83
83
84
84
85
-
86
85
impl ScrollToRowMode {
87
86
pub fn as_str ( & self ) -> & ' static str {
88
87
match self {
@@ -114,13 +113,16 @@ pub struct ArrayTable {
114
113
seed2 : usize , // seed for Id
115
114
pub matching_rows : Vec < usize > ,
116
115
pub matching_row_selected : usize ,
116
+ pub matching_columns : Vec < usize > ,
117
+ pub matching_column_selected : usize ,
117
118
pub scroll_to_column : String ,
118
119
pub scroll_to_row : String ,
119
120
pub scroll_to_row_mode : ScrollToRowMode ,
120
121
121
122
// Handle interaction
122
123
pub next_frame_reset_scroll : bool ,
123
124
pub changed_scroll_to_column_value : bool ,
125
+ pub changed_matching_column_selected : bool ,
124
126
pub changed_matching_row_selected : bool ,
125
127
pub changed_scroll_to_row_value : Option < Instant > ,
126
128
@@ -151,16 +153,23 @@ impl super::View<ArrayResponse> for ArrayTable {
151
153
let mut scroll_to_x = None ;
152
154
if self . changed_scroll_to_column_value {
153
155
self . changed_scroll_to_column_value = false ;
154
- let mut index = self . column_selected . iter ( ) . position ( |c| {
155
- c. name . to_lowercase ( ) . eq ( & concat_string ! ( "/" , & self . scroll_to_column. to_lowercase( ) ) )
156
- } ) ;
157
- if index. is_none ( ) {
158
- index = self . column_selected . iter ( ) . position ( |c| {
159
- c. name . to_lowercase ( ) . contains ( & self . scroll_to_column . to_lowercase ( ) )
160
- } ) ;
156
+ self . changed_matching_column_selected = true ;
157
+ self . matching_columns . clear ( ) ;
158
+ self . matching_column_selected = 0 ;
159
+ if !self . scroll_to_column . is_empty ( ) {
160
+ for ( index, column) in self . column_selected . iter ( ) . enumerate ( ) {
161
+ if column. name . to_lowercase ( ) . eq ( & concat_string ! ( "/" , & self . scroll_to_column. to_lowercase( ) ) )
162
+ || column. name . to_lowercase ( ) . contains ( & self . scroll_to_column . to_lowercase ( ) ) {
163
+ self . matching_columns . push ( index) ;
164
+ }
165
+ }
161
166
}
162
- if let Some ( index) = index {
163
- if let Some ( offset) = self . columns_offset . get ( index) {
167
+ }
168
+
169
+ if self . changed_matching_column_selected {
170
+ self . changed_matching_column_selected = false ;
171
+ if !self . matching_columns . is_empty ( ) {
172
+ if let Some ( offset) = self . columns_offset . get ( self . matching_columns [ self . matching_column_selected ] ) {
164
173
scroll_to_x = Some ( * offset) ;
165
174
}
166
175
}
@@ -243,6 +252,8 @@ impl ArrayTable {
243
252
windows : vec ! [ ] ,
244
253
matching_rows : vec ! [ ] ,
245
254
matching_row_selected : 0 ,
255
+ matching_columns : vec ! [ ] ,
256
+ matching_column_selected : 0 ,
246
257
scroll_to_column : "" . to_string ( ) ,
247
258
changed_scroll_to_column_value : false ,
248
259
last_parsed_max_depth,
@@ -251,6 +262,7 @@ impl ArrayTable {
251
262
scroll_to_row : "" . to_string ( ) ,
252
263
changed_scroll_to_row_value : None ,
253
264
changed_matching_row_selected : false ,
265
+ changed_matching_column_selected : false ,
254
266
editing_index : RefCell :: new ( None ) ,
255
267
editing_value : RefCell :: new ( String :: new ( ) ) ,
256
268
is_sub_table : false ,
@@ -343,7 +355,6 @@ impl ArrayTable {
343
355
}
344
356
345
357
pub fn row_height ( style : & Arc < Style > , spacing : & Spacing ) -> f32 {
346
-
347
358
egui:: TextStyle :: Body
348
359
. resolve ( style)
349
360
. size
@@ -452,7 +463,7 @@ impl ArrayTable {
452
463
if Self :: is_filterable ( column) {
453
464
let values = ui. memory_mut ( |mem| {
454
465
let cache = mem. caches . cache :: < ColumnFilterCache > ( ) ;
455
-
466
+
456
467
cache. get ( ( column, & self . nodes , & self . parent_pointer ) )
457
468
} ) ;
458
469
if !values. is_empty ( ) {
0 commit comments