Skip to contents

Create a faketable object

Usage

faketable(data, table_def, rowId = NULL, show_delete = FALSE)

Arguments

data

A data.frame

table_def

A table_def() object

rowId

A character vector of length one identifying which column is a primary key, if any.

show_delete

A named list passed to the shiny::column() that holds the Delete button. If FALSE, the delete column will not be shown.

Value

A faketable object with the following properties:

  • data: The current state of the table of inputs

  • inserted: Rows from data that were inserted into the data (were not present in .raw_data)

  • updated: Rows from data that have been modified, but were present in .raw_data

  • deleted: Rows that were in .raw_data, but have been removed from and do not appear in data

  • .raw_data: The data originally pased to faketable() with the addition of a .rowId column as the first column. This column is calculated using by hashing either the provided rowId column or using the row number and system time.

  • .rowId: The value of the rowId argument

  • .data: The same as data, but retains the .rowId column

  • .inserted: The same as inserted, but retains the .rowId column

  • .deleted: All rows that have been removed from data, including those that were inserted then deleted

  • .table_def: A copy of the user supplied table_def() passed as the argument table_def

  • .show_delete: A copy of the user supplied list passed as the argument show_delete. If TRUE was supplied, it is replaced with list().

  • .iteration: INTERNAL USE ONLY.

Details

A faketable object is an S7::S7_object() with the class faketable. S7 object properties are accessed using an @, rather than the traditional $. For example, the property data for a faketable object called faketable can be accessed using faketable@data.

A note on faketables@.iteration: Shiny does not currently support removing inputs from the server. This allows faketables to refresh fully after using dbWriteTable(), by creating a new backend set of input ids which otherwise would be duplicated because the data is the same.

See also

For more details on S7, see the vignette on the website or by running: vignette('S7', package = 'S7')