editDT: Editable DataTable shiny Module

Description Usage Arguments Value Creation notes Examples

Description

A shiny Module to create an editable DataTable. It adds buttons at the top of the table for deleting selected rows, undoing, and redoing modifications to the table including deletes, additions, and edits, deletions. Additionally it adds a new row to the front of the dataset that holds a row specific delete and edit buttons.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
editDT_ui(id)

editDT_server(
  id,
  inputTableFull,
  inputModifyPlaceID,
  colToDisplay = NULL,
  colToEdit = NULL,
  colWidth = NULL,
  colSort = NULL,
  indexStart = 0,
  allowDeletes = TRUE,
  allowEdits = TRUE
)

Arguments

id

id for module. The id should match in both the editDT_ui and editDT_server function calls.

inputTableFull

Main input table.Must be initialized with editDT_prepareNewData(). Must be passed in a reactive() statement

inputModifyPlaceID

Modify ID. Initialized at 0. Must be passed in a reactive() statement

colToDisplay

Character vector of column names to display in the main table.

colToEdit

Character vector of column names that will be editable when an edit button is pressed.

colWidth

Named numeric vector for the width of displayed columns.

colSort

Named logical vector for whether sorting is enabled on a columns. (Currently Unimplemented)

indexStart

Whether the index should start at 0 or 1. If the table contains all new data (i.e. all from a form entry in a current session) set the index to 1, else set it to 0 (the default)

allowDeletes, allowEdits

TRUE/FALSE on whether or not to include the edit or delete buttons. Both TRUE by default.

input, output, session

Internal parameters for shiny. These don't have to be specified.

Value

editDT_server retruns a reactiveValues list containing the modified input table named 'tableFull' and the modifyID named 'modifyPlaceID'. These returns are used to allow the main inputs to be adapted and changed inside and outside the module.

Creation notes

This module was first created 2020-12-11 when designing the CovidDataEntry Shiny application.

Examples

1
2
3
4
5
6
## Not run: 

# See the example file in the repo at /dev/02_Example_editDT_shinyModule.R for an example of how this module works


## End(Not run)

MARC-KC/marcRviz documentation built on March 29, 2021, 11:30 p.m.