Skip to content

Commit

Permalink
Fixed #272
Browse files Browse the repository at this point in the history
  • Loading branch information
thekangaroofactory committed Sep 26, 2024
1 parent 1236b2b commit 41887be
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion R/kitems_module_server.R
Original file line number Diff line number Diff line change
Expand Up @@ -715,11 +715,13 @@ kitemsManager_Server <- function(id, r, path,
removeModal()

# -- drop column! & store
cat(MODULE, "Drop attribute from all items \n")
items <- k_items()
items[input$dm_dz_att_name] <- NULL
k_items(items)

# -- update data model & store
cat(MODULE, "Drop attribute from data model \n")
dm <- k_data_model()
dm <- dm[dm$name != input$dm_dz_att_name, ]
k_data_model(dm)
Expand Down Expand Up @@ -869,6 +871,12 @@ kitemsManager_Server <- function(id, r, path,
# -- get selected row
row <- input$data_model_rows_selected

# -- check out of limit value #272
# If last row is selected and attribute is deleted, a crash would occur
if(!is.null(row))
if(row > nrow(k_data_model()))
row <- NULL

# -- check NULL (no row selected)
if(is.null(row)){

Expand All @@ -890,7 +898,7 @@ kitemsManager_Server <- function(id, r, path,

}

}, ignoreNULL = FALSE)
}, ignoreNULL = FALSE, ignoreInit = TRUE)


# -- observe upd_att button
Expand Down

0 comments on commit 41887be

Please sign in to comment.