Background Item Management
Use case & motivation
The xxx.
Implementation
– create_widget No impact
– update_widget Need to select item first milestones$selected_items(id)
– delete_widget Need to select item(s) first milestones$selected_items(id)
– trigger item update milestonesupdate(id)
– trigger item delete milestonesdelete(id)
actionLink(inputId = paste0(“update_”, milestone$id), label = “edit”, icon = icon(“pen-to-square”), onclick = sprintf(‘Shiny.setInputValue(“%s”, this.id, {priority: “event”})’, ns(“edit_milestone”)))
If more than one link, need to compute unique Id otherwise there will be a warning in the browser console for duplicated id.
In this case, input value must be treated in the observer to get the id
# -- update
observeEvent(input$edit_milestone, {
# -- get id (pattern = "update_id)
id <- unlist(strsplit(input$edit_milestone, "_"))[2]
cat("Edit milestone =", id, "\n")
# ... do something here
})
You could also create a global action observer - setInputValue > ‘actions’ - observeEvent(input$actions … get both action & id from the input value
# -- Module server return value
list(id,
url,
items,
data_model,
filtered_items,
selected_items,
clicked_column,
filter_date)
xxx.
Considerations
Thxxx