crudTableUI: Creates a data table view capable of CRUD operations.

Description Usage Arguments Details Value See Also Examples

View source: R/crudTableUI.R

Description

This shiny module allows to view data in a datatable and also add new data, modify existent records or delete the records. This UI widget consists of a datatable view, which contains buttons for editing and deleting of table rows, and an action button for the creation of new records.

Usage

1
2
3
4
5
6
7
crudTableUI(
  id,
  newButtonLabel = "New Record",
  newButtonIcon = icon("plus"),
  newButtonClass = "btn-primary",
  newButtonWidth = NULL
)

Arguments

id

The ID of the widget

newButtonLabel

Label of the button for adding of new records. If 'NULL', the button is not shown.

newButtonIcon

Icon of the button for adding of new records

newButtonClass

Class of the button for adding of new records

newButtonWidth

The width of the button, e.g. '400px' or '100%'

Details

This function is the UI part of the module. For server part see crudTableServer.

Value

An editable data table widget

See Also

crudTableServer

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
## Not run: 
library(shiny)
library(crudtable)

# Create Data Access Object
dao <- dataFrameDao(CO2)

# Create edit form dialog
myFormUI <- function(id) {
    ns <- NS(id)
    formUI(id,
           selectInput(ns('Type'), 'Type', choices = c('Quebec', 'Mississippi')),
           selectInput(ns('Type'), 'Type', choices = c('Quebec', 'Mississippi')),
           selectInput(ns('Treatment'), 'Treatment', choices = c('nonchilled', 'chilled')),
           numericInput(ns('conc'), 'Ambient CO2 concentration [ml/L]',
                        value = 100, min = 50, max = 1000),
           numericInput(ns('uptake'), 'CO2 uptake rates [umol/m2 sec]',
                        value = 0, min = 0, max = 100),
    )
}

# Create edit form dialog handler
myFormServer <- formServerFactory(dao$getAttributes())

# User Interface
ui <- fluidPage(
    crudTableUI('crud')
)

# Server-side
server <- function(input, output, session) {
    crudTableServer('crud', dao, myFormUI, myFormServer)
}

# Run the shiny app
shinyApp(ui = ui, server = server)

## End(Not run)

beerda/crudtable documentation built on July 13, 2020, 2:16 p.m.