Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion editbl/DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: editbl
Type: Package
Version: 1.3.1
Date: 2025-09-24
Date: 2025-09-30
Title: 'DT' Extension for CRUD (Create, Read, Update, Delete) Applications in 'shiny'
Authors@R: c(person("Jasper", "Schelfhout", "", "jasper.schelfhout@openanalytics.eu",
role = c("aut", "cre")),
Expand Down
58 changes: 42 additions & 16 deletions editbl/R/eDT.R
Original file line number Diff line number Diff line change
Expand Up @@ -1647,13 +1647,13 @@ createCloneButtonHTML <- function(

#' Re-usable documentation
#' @param canEditRow can be either of the following:
#' - `logical`, e.g. TRUE or FALSE
#' - `logical`, e.g. TRUE or FALSE. In case of `FALSE`, buttons will not be visible except for new rows.
#' - `function`. Needs as input an argument `row` which accepts a single row `tibble` and as output TRUE/FALSE.
#' @param canCloneRow can be either of the following:
#' - `logical`, e.g. TRUE or FALSE
#' - `logical`, e.g. TRUE or FALSE. In case of `FALSE`, buttons will not be visible except for new rows.
#' - `function`. Needs as input an argument `row` which accepts a single row `tibble` and as output TRUE/FALSE.
#' @param canDeleteRow can be either of the following:
#' - `logical`, e.g. TRUE or FALSE
#' - `logical`, e.g. TRUE or FALSE. In case of `FALSE`, buttons will not be visible except for new rows.
#' - `function`. Needs as input an argument `row` which accepts a single row `tibble` and as output TRUE/FALSE.
#' @keywords internal
canXXXRowTemplate <- function(canEditRow, canCloneRow, canDeleteRow){
Expand All @@ -1679,19 +1679,45 @@ createButtons <- function(
canCloneRow = TRUE,
statusCol = '_editbl_status'
){
deleteButton <- createDeleteButtonHTML(
ns=ns,
suffix=suffix,
disabled = !evalCanDeleteRow(row=row, canDeleteRow=canDeleteRow, statusCol=statusCol))
editButton <- createEditButtonHTML(
ns=ns,
suffix=suffix,
disabled = !evalCanEditRow(row=row, canEditRow=canEditRow, statusCol=statusCol))
cloneButton <- createCloneButtonHTML(
ns = ns,
suffix = suffix,
disabled = !evalCanCloneRow(row = row, canCloneRow = canCloneRow, statusCol = statusCol))

# Hide delete completely if canDeleteRow = FALSE. With the exception of newly created rows.
if(is.logical(canDeleteRow)
&& !canDeleteRow
&& (is.null(statusCol) || row[[statusCol]] != 'inserted')
){
deleteButton <- ""
} else {
deleteButton <- createDeleteButtonHTML(
ns=ns,
suffix=suffix,
disabled = !evalCanDeleteRow(row=row, canDeleteRow=canDeleteRow, statusCol=statusCol))
}

# Hide edit completely if canEditRow = FALSE. With the exception of newly created rows.
if(is.logical(canEditRow)
&& !canEditRow
&& (is.null(statusCol) || row[[statusCol]] != 'inserted')
){
editButton <- ""
} else {
editButton <- createEditButtonHTML(
ns=ns,
suffix=suffix,
disabled = !evalCanEditRow(row=row, canEditRow=canEditRow, statusCol=statusCol))
}

# Hide clone button completely if canCloneRow = FALSE. With the exception of newly created rows.
if(is.logical(canCloneRow)
&& !canCloneRow
&& (is.null(statusCol) || row[[statusCol]] != 'inserted')
){
cloneButton <- ""
} else {
cloneButton <- createCloneButtonHTML(
ns = ns,
suffix = suffix,
disabled = !evalCanCloneRow(row = row, canCloneRow = canCloneRow, statusCol = statusCol))
}

result <- sprintf('<div class="btn-group">%1$s%2$s%3$s</div>',
deleteButton,
editButton,
Expand Down
1 change: 1 addition & 0 deletions editbl/inst/NEWS
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
1.3.1
o Remove non-exported functions from documentation.
o FIX: saving changes for single-column data
o FEAT: hide buttons when canXXXRow argument is FALSE.
1.3.0
o FIX: castToTemplate removed first row of adapted data in case the template was empty.
o FEAT: Add a clone button for each row.
Expand Down
6 changes: 3 additions & 3 deletions editbl/man/addButtons.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions editbl/man/canXXXRowTemplate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions editbl/man/createButtons.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions editbl/man/eDT.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions editbl/man/initData.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.