add_table dialog is now working properly well
This commit is contained in:
@@ -78,15 +78,13 @@ pub fn handle_add_column_action(
|
||||
/// Handles deleting columns marked as selected in the AddTableState.
|
||||
pub fn handle_delete_selected_columns(
|
||||
add_table_state: &mut AddTableState,
|
||||
command_message: &mut String,
|
||||
) {
|
||||
) -> String {
|
||||
let initial_count = add_table_state.columns.len();
|
||||
// Keep only the columns that are NOT selected
|
||||
add_table_state.columns.retain(|col| !col.selected);
|
||||
let deleted_count = initial_count - add_table_state.columns.len();
|
||||
|
||||
if deleted_count > 0 {
|
||||
*command_message = format!("Deleted {} selected column(s).", deleted_count);
|
||||
add_table_state.has_unsaved_changes = true;
|
||||
// Reset selection highlight as indices have changed
|
||||
add_table_state.column_table_state.select(None);
|
||||
@@ -94,8 +92,9 @@ pub fn handle_delete_selected_columns(
|
||||
// if !add_table_state.columns.is_empty() {
|
||||
// add_table_state.column_table_state.select(Some(0));
|
||||
// }
|
||||
format!("Deleted {} selected column(s).", deleted_count)
|
||||
} else {
|
||||
*command_message = "No columns marked for deletion.".to_string();
|
||||
"No columns marked for deletion.".to_string()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user