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

Update dashTable to 4.5.1 with support for async loading in R #668

Merged
merged 5 commits into from
Dec 19, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
9 changes: 4 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
Package: dashTable
Title: Core Interactive Table Component for Dash
Title: Dash table
Version: 4.5.1
Authors @R: as.person(c(Chris Parmer <chris@plot.ly>))
Description: Dash DataTable is an interactive table component designed for designed for viewing, editing, and exploring large datasets. DataTable is rendered with standard, semantic HTML <table/> markup, which makes it accessible, responsive, and easy to style. This component was written from scratch in React.js specifically for the Dash community. Its API was designed to be ergonomic and its behavior is completely customizable through its properties.
Description: Dash table
Depends: R (>= 3.0.2)
Imports:
Suggests:
Imports:
Suggests:
License: MIT + file LICENSE
URL: https://github.com/plotly/dash-table
BugReports: https://github.com/plotly/dash-table/issues
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# AUTO GENERATED FILE - DO NOT EDIT

export(dashDataTable)
export(df_to_list)
8 changes: 8 additions & 0 deletions R/df_to_list.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
df_to_list <- function(df) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file generated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Marc-Andre-Rivet This function was also user-authored (by me), to emulate the syntax on the Python side using df_to_dict. R users reported that it made using dashDataTable easier for them, so it's persisted. It turns out that it's useful for dashBio as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one is OK to leave in master, along with the rest of the R package items (vignettes, Rd files, etc).

if(!(is.data.frame(df)))
stop("df_to_list requires a data.frame object; please verify that df is of the correct type.")
setNames(lapply(split(df, seq(nrow(df))),
FUN = function (x) {
as.list(x)
}), NULL)
}
10 changes: 5 additions & 5 deletions R/internal.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@ version = "4.5.1", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'bundle.js.map',
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashTable",
all_files = FALSE), class = "html_dependency"),
all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
`dash_table` = structure(list(name = "dash_table",
version = "4.5.1", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'async~export.js',
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashTable",
all_files = FALSE), class = "html_dependency"),
all_files = FALSE, async = TRUE), class = "html_dependency"),
`dash_table` = structure(list(name = "dash_table",
version = "4.5.1", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'async~export.js.map',
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashTable",
all_files = FALSE), class = "html_dependency"),
all_files = FALSE, dynamic = TRUE), class = "html_dependency"),
`dash_table` = structure(list(name = "dash_table",
version = "4.5.1", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'async~table.js',
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashTable",
all_files = FALSE), class = "html_dependency"),
all_files = FALSE, async = TRUE), class = "html_dependency"),
`dash_table` = structure(list(name = "dash_table",
version = "4.5.1", src = list(href = NULL,
file = "deps"), meta = NULL,
script = 'async~table.js.map',
stylesheet = NULL, head = NULL, attachment = NULL, package = "dashTable",
all_files = FALSE), class = "html_dependency"))
all_files = FALSE, dynamic = TRUE), class = "html_dependency"))
return(deps_metadata)
}
4 changes: 2 additions & 2 deletions dash_table/async~table.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_table/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_table/bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_table/demo.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dash_table/demo.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions inst/deps/async~table.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/deps/bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/deps/bundle.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/deps/demo.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion inst/deps/demo.js.map

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions man/df_to_list.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
% Auto-generated: do not edit by hand
\name{df_to_list}

\alias{df_to_list}

\title{Convert data.frame objects to list-of-lists format}

\description{
Convert a \code{\link{data.frame}} to a list of lists for compatibility with \code{\link{dashDataTable}}. The function will return a nested list object in which the sublists contain named elements of varying type; the names correspond to the column names in the original \code{\link{data.frame}}.
}

\usage{
df_to_list(df=NULL)
}

\arguments{
\item{df}{A \code{data.frame} object, which will be transformed into a list of lists. Each row will become a single named list, in which the elements are named as the columns from which they were extracted.}
}

\examples{
\dontrun{
# first, create data frame
df <- read.csv(url(
'https://raw.githubusercontent.com/plotly/datasets/master/solar.csv'
),
check.names=FALSE,
stringsAsFactors=FALSE
)

# then convert to list-of-lists format for use in dashTable
# the following snippet below will print as JSON
# see the help for dashDataTable to see an actual app example
dashDataTable(
id = 'table',
columns = lapply(colnames(df), function(x) {
list(name = x, id = x)
}),
data = df_to_list(df)
)
}
}