Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Contribute basic examples to dashTable package for R #711

Merged
merged 2 commits into from
Mar 3, 2020
Merged
Changes from 1 commit
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
68 changes: 68 additions & 0 deletions dash-info.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,71 @@ pkg_help_description: >-
properties.
pkg_help_title: >-
Core Interactive Table Component for Dash
r_examples:
- name: dashDataTable
dontrun: TRUE
code: |
# For comprehensive documentation of this package's features,
# please consult https://dashr.plot.ly/datatable
#
# A package vignette is currently in development and will
# provide many of the same examples currently available online
# in an offline-friendly format.
library(dash)
library(dashTable)

app <- Dash$new()

# We can easily restrict the number of rows to display at
# once by using style_table:
app$layout(
dashDataTable(
id = "table",
columns = lapply(colnames(iris),
function(colName){
list(
id = colName,
name = colName
)
}),
style_table = list(
maxHeight = "250px",
overflowY = "scroll"
),
data = df_to_list(iris)
)
)

app$run_server()

app <- Dash$new()

# We can also make rows and columns selectable/deletable
# by setting a few additional attributes:
app$layout(
dashDataTable(
id = "table",
columns = lapply(colnames(iris),
function(colName){
list(
id = colName,
name = colName,
deletable = TRUE
)
}),
style_table = list(
maxHeight = "250px",
overflowY = "scroll"
),
data = df_to_list(iris),
editable = TRUE,
filter_action = "native",
sort_action = "native",
sort_mode = "multi",
column_selectable = "single",
row_selectable = "multi",
row_deletable = TRUE
)
)

app$run_server()