Learn R Programming

yonder (version 0.0.5)

tableThruput: Table thruput

Description

Use tableThruput() to create a table output you can update with renderTable(). Access selected table columns by referencing the same table id as an input.

Usage

tableThruput(id, ..., borders = "rows", striped = FALSE,
  compact = FALSE, responsive = FALSE, editable = FALSE)

renderTable(expr, env = parent.frame(), quoted = FALSE)

Arguments

id

A character string specifying the id of the reactive input.

...

Additional named arguments passed as HTML attributes to the parent element.

borders

One of "rows", "all", or "none" specifying what borders are applied to the table, defaults to "rows". "rows" will apply borders between table rows. "all" will apply borders between table rows and columns. "none" removes all borders from the table.

striped

One TRUE or FALSE specifying if the table rows alternate between light and darker backgrounds.

compact

One of TRUE or FALSE specifying if the table cells are rendered with less space, defaults to FALSE.

responsive

One of TRUE or FALSE specifying if the table is allowed to scroll horizontally, default to FALSE. This is useful when fitting wide tables onto small viewports.

editable

One of TRUE or FALSE specifying if the user can edit table cells, defaults to FALSE.

expr

An expression which returns a data frame or NULL. If a data frame is returned the table thruput is re-rendered, otherwise if NULL the current table is left as is.

env

The environment in which to evaluate expr, defaults to parent.frame().

quoted

One of TRUE or FALSE specifying if expr is a quoted expression.

Example application

shinyApp(
  ui = container(
    tableThruput(id = "tableExample", responsive = TRUE)
  ),
  server = function(input, output) {
    output$tableExample <- renderTable({
      iris
    })
  }
)

Examples

Run this code
# NOT RUN {
### Responsive tables

# In practice you will use `renderTable()` to update the data in a table.
# These live examples have been populated automatically for the sake of
# the demo.

# }
# NOT RUN {
<!-- % <script> -->
# }
# NOT RUN {
<!-- % $(function() { -->
# }
# NOT RUN {
<!-- %   $(".yonder-table").each(function() { -->
# }
# NOT RUN {
<!-- %     $(this).table({ data: iris }); -->
# }
# NOT RUN {
<!-- %   }); -->
# }
# NOT RUN {
<!-- % }); -->
# }
# NOT RUN {
<!-- % </script> -->
# }
# NOT RUN {
tableThruput(
  id = "table1",  # <-
  responsive = TRUE
)

### Borders on rows and columns

tableThruput(
  id = "table2",
  borders = "all",  # <-
  responsive = TRUE
)

### Edit table values

tableThruput(
  id = "table3",
  editable = TRUE,  # <-
  responsive = TRUE
)

# }

Run the code above in your browser using DataLab