Skip to content

Commit

Permalink
rename library to D3TableFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
tsgmnd committed Jan 27, 2015
1 parent 2c4f327 commit d57be94
Show file tree
Hide file tree
Showing 28 changed files with 111 additions and 113 deletions.
File renamed without changes.
10 changes: 5 additions & 5 deletions DESCRIPTION
@@ -1,13 +1,13 @@
Package: tableFilter
Package: D3TableFilter
Title: A table widget based on Max Guglielmi's "HTML Table Filter Generator"
and D3.js
Version: 0.1
Version: 0.5
Authors@R: person("Thomas", "Siegmund", email = "thomas.siegmund@gmail.com",
role = c("aut", "cre"))
Description: tableFilter provides a powerful and flexible HTML table widget for
Description: D3TableFilter provides a powerful and flexible HTML table widget for
use with the htmlwidgets R library. It allows R users to create HTML tables
with functions for advanced filtering and sorting. It also allows for the
colouring of table cells based on their values.
with functions for advanced filtering and sorting. It also allows for advanced
formatting of table cells using D3 functions.
Depends:
R (>= 3.1.0)
Imports:
Expand Down
13 changes: 7 additions & 6 deletions LICENSE
@@ -1,9 +1,9 @@
TableFilter R library
=====================
D3TableFilter R library
=======================

The MIT License (MIT)

Copyright (c) 2014 Thomas Siegmund
Copyright (c) 2015 Thomas Siegmund

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand All @@ -26,6 +26,7 @@ THE SOFTWARE.

Included Javascript Libraries
=============================
The TableFilter R library includes the "TableFilter" and the "D3"
javascript libraries. For license information regarding these libraries
see the license files in the lib/tablefilter and lib/d3 subdirectories.
The TableFilter R library includes the "TableFilter", the "colorbrewer",
and the "D3" javascript libraries. For license information regarding these
libraries see the license files in the lib/tablefilter lib/colorbrewer, and
lib/d3 subdirectories.
6 changes: 3 additions & 3 deletions NAMESPACE
@@ -1,16 +1,16 @@
# Generated by roxygen2 (4.1.0): do not edit by hand

export(D3TableFilter)
export(D3TableFilterOutput)
export(JS)
export(clearFilters)
export(confirmEdit)
export(disableEdit)
export(enableEdit)
export(rejectEdit)
export(renderTableFilter)
export(renderD3TableFilter)
export(setCellValue)
export(setFilter)
export(setFootCellValue)
export(setRowClass)
export(tableFilter)
export(tableFilterOutput)
import(htmlwidgets)
19 changes: 9 additions & 10 deletions R/tableFilter.R → R/D3TableFilter.R
@@ -1,11 +1,10 @@
#' tableFilter Generate a HTML table widget with advanced filtering, sorting and colouring.
#' D3TableFilter Generate a HTML table widget with advanced filtering, sorting and colouring.
#'
#' R interface to Max Guglielmi's \href{http://tablefilter.free.fr/ }{HTML Table
#' Filter Generator} JavaScript library. Provides advanced filtering and
#' sorting. Columns can be coloured based on displayed values using D3 colour
#' scales.
#' sorting. Columns can be formatted using D3 functions.
#'
#' @section Configuration: The tableFilter widget can be highly customized. See
#' @section Configuration: The D3TableFilter widget can be highly customized. See
#' the website of the JavaScript library
#' \href{http://tablefilter.free.fr/}{HTML Table Filter Generator}
#' for details. Configuration is passed as a
Expand Down Expand Up @@ -104,7 +103,7 @@
#' @import htmlwidgets
#' @export JS
#' @export
tableFilter <- function(df, tableProps, showRowNames = FALSE, colNames = NULL, extensions = c(), selectableRows = NULL, selectableRowsClass = "info", bgColScales = list(), fgColScales = list(), edit = FALSE, radioButtons = NULL, checkBoxes = NULL, cellFunctions = list(), filterInput = FALSE, initialFilters = list(), footData = NULL, footCellFunctions = list(), width = NULL, height = NULL) {
D3TableFilter <- function(df, tableProps, showRowNames = FALSE, colNames = NULL, extensions = c(), selectableRows = NULL, selectableRowsClass = "info", bgColScales = list(), fgColScales = list(), edit = FALSE, radioButtons = NULL, checkBoxes = NULL, cellFunctions = list(), filterInput = FALSE, initialFilters = list(), footData = NULL, footCellFunctions = list(), width = NULL, height = NULL) {

if(is.matrix(df)) {
df <- as.data.frame(df);
Expand Down Expand Up @@ -198,7 +197,7 @@ x <- list(
)

# create the widget
htmlwidgets::createWidget("tableFilter", x, width = width,
htmlwidgets::createWidget("D3TableFilter", x, width = width,
height = height, sizingPolicy = htmlwidgets::sizingPolicy(
viewer.padding = 0,
viewer.paneHeight = 800,
Expand All @@ -222,14 +221,14 @@ x <- list(
#'
#' @name tableFilter-shiny
#' @export
tableFilterOutput <- function(outputId, width = "100%", height = "400px") {
shinyWidgetOutput(outputId, "tableFilter", width, height, package = "tableFilter")
D3TableFilterOutput <- function(outputId, width = "100%", height = "400px") {
shinyWidgetOutput(outputId, "D3TableFilter", width, height, package = "D3TableFilter")
}
#' @rdname tableFilter-shiny
#' @export
renderTableFilter <- function(expr, env = parent.frame(), quoted = FALSE) {
renderD3TableFilter <- function(expr, env = parent.frame(), quoted = FALSE) {
if (!quoted) { expr <- substitute(expr) } # force quoted
shinyRenderWidget(expr, tableFilterOutput, env, quoted = TRUE)
shinyRenderWidget(expr, D3TableFilterOutput, env, quoted = TRUE)
}

#' Give feedback in case of validaton failure.
Expand Down
56 changes: 28 additions & 28 deletions inst/examples/basic/server.R
@@ -1,28 +1,28 @@
# ------------------------------------------------------
# Minimal shiny app demonstrating the tableFilter widget
# server.R
# ------------------------------------------------------
library(shiny)
library(htmlwidgets)
library(tableFilter)

data(mtcars);

shinyServer(function(input, output, session) {
output$mtcars <- renderTableFilter({

# Define table properties. See http://tablefilter.free.fr/doc.php
# for a complete reference
tableProps <- list(
alternate_rows = TRUE,
btn_reset = TRUE,
sort = TRUE,
sort_config = list(
# alphabetic sorting for the row names column, numeric for all other columns
sort_types = c("String", rep("Number", ncol(mtcars)))
)
);

tableFilter(mtcars, tableProps, showRowNames = TRUE, rowNamesColumn = "Model");
})
})
# ------------------------------------------------------
# Minimal shiny app demonstrating the tableFilter widget
# server.R
# ------------------------------------------------------
library(shiny)
library(htmlwidgets)
library(D3TableFilter)

data(mtcars);

shinyServer(function(input, output, session) {
output$mtcars <- renderD3TableFilter({

# Define table properties. See http://tablefilter.free.fr/doc.php
# for a complete reference
tableProps <- list(
alternate_rows = TRUE,
btn_reset = TRUE,
sort = TRUE,
sort_config = list(
# alphabetic sorting for the row names column, numeric for all other columns
sort_types = c("String", rep("Number", ncol(mtcars)))
)
);

D3TableFilter(mtcars, tableProps, showRowNames = TRUE);
})
})
20 changes: 10 additions & 10 deletions inst/examples/basic/ui.R
@@ -1,10 +1,10 @@
# ------------------------------------------------------
# Minimal shiny app demonstrating the tableFilter widget
# ui.R
# ------------------------------------------------------
shinyUI(fluidPage(
title = 'Basic usage of TableFilter in Shiny',
fluidRow(
column(width = 12, tableFilterOutput('mtcars'))
)
))
# ------------------------------------------------------
# Minimal shiny app demonstrating the tableFilter widget
# ui.R
# ------------------------------------------------------
shinyUI(fluidPage(
title = 'Basic usage of TableFilter in Shiny',
fluidRow(
column(width = 12, D3TableFilterOutput('mtcars'))
)
))
6 changes: 3 additions & 3 deletions inst/examples/colour/server.R
@@ -1,9 +1,9 @@
library(shiny)
library(htmlwidgets)
library(tableFilter)
library(D3TableFilter)

shinyServer(function(input, output, session) {
output$colours <- renderTableFilter({
output$colours <- renderD3TableFilter({

tbl <- data.frame(AutoScale = round(seq(1, 200, length.out = 30), 1));
tbl$LinearNumeric <- tbl$AutoScale;
Expand Down Expand Up @@ -95,7 +95,7 @@ shinyServer(function(input, output, session) {
}')
);

tableFilter(tbl, table_Props,
D3TableFilter(tbl, table_Props,
showRowNames = FALSE, bgColScales = bgColScales, fgColScales = fgColScales);
})
})
4 changes: 2 additions & 2 deletions inst/examples/colour/ui.R
@@ -1,10 +1,10 @@
library(shiny)
library(htmlwidgets)
library(tableFilter)
library(D3TableFilter)

shinyUI(fluidPage(
title = 'Colourful tables',
fluidRow(
column(width = 12, tableFilterOutput('colours'))
column(width = 12, D3TableFilterOutput('colours'))
)
))
9 changes: 4 additions & 5 deletions inst/examples/feature/server.R
@@ -1,11 +1,11 @@
library(shiny)
library(htmlwidgets)
library(tableFilter)
library(D3TableFilter)

data(mtcars)

shinyServer(function(input, output, session) {
output$mtcars <- renderTableFilter({
output$mtcars <- renderD3TableFilter({

# configuration object listing many of TableFilters paramters.
# There are more in http://tablefilter.free.fr/doc.php
Expand Down Expand Up @@ -89,10 +89,9 @@ shinyServer(function(input, output, session) {
# make use of TableFilters "col_operation"
footData <- data.frame(Model = c("Mean", "Median"), mpg = 0, cyl = 0, disp = 0, hp = 0, drat = 0, wt = 0, qsec = 0, vs = 0, am = 0, gear = 0, carb = 0);

tableFilter(mtcars, table_Props,
D3TableFilter(mtcars, table_Props,
showRowNames = TRUE,
extensions = c('ColsVisibility', 'ColumnsResizer', 'FiltersRowVisibility'),
footData = footData,
rowNamesColumn = "Model");
footData = footData);
})
})
4 changes: 2 additions & 2 deletions inst/examples/feature/ui.R
@@ -1,10 +1,10 @@
library(shiny)
library(htmlwidgets)
library(tableFilter)
library(D3TableFilter)

shinyUI(fluidPage(
title = 'Full featured TableFilter example',
fluidRow(
column(width = 12, tableFilterOutput('mtcars'))
column(width = 12, D3TableFilterOutput('mtcars'))
)
))
10 changes: 5 additions & 5 deletions inst/examples/interaction/server.R
Expand Up @@ -3,7 +3,7 @@
# ----------------------------------------------------------------------
library(shiny)
library(htmlwidgets)
library(tableFilter)
library(D3TableFilter)

data(mtcars);
mtcars <- mtcars[, 1:3];
Expand Down Expand Up @@ -141,7 +141,7 @@ shinyServer(function(input, output, session) {
revals$mtcars[revals$rowIndex, ];
});

output$mtcars <- renderTableFilter({
output$mtcars <- renderD3TableFilter({

# define table properties. See http://tablefilter.free.fr/doc.php
# for a complete reference
Expand Down Expand Up @@ -328,7 +328,7 @@ shinyServer(function(input, output, session) {
footData <- data.frame(Rownames = "Mean", mpg = mean(mtcars$mpg), cyl = mean(mtcars$cyl), disp = mean(mtcars$disp));

# the mtcars table output
tableFilter(mtcars, tableProps,
D3TableFilter(mtcars, tableProps,
showRowNames = TRUE,
colNames = colNames,
edit = c("col_1", "col_3"),
Expand Down Expand Up @@ -397,7 +397,7 @@ shinyServer(function(input, output, session) {
})

## demonstrate selectable rows interface
output$mtcars2 <- renderTableFilter({
output$mtcars2 <- renderD3TableFilter({

# define table properties. See http://tablefilter.free.fr/doc.php
# for a complete reference
Expand Down Expand Up @@ -426,7 +426,7 @@ shinyServer(function(input, output, session) {
# make use of TableFilters "col_operation"
footData <- data.frame(Rownames = "Mean", mpg = 0, cyl = 0);

tableFilter(mtcars[ , 1:2],
D3tableFilter(mtcars[ , 1:2],
tableProps, showRowNames = TRUE,
selectableRows = "multi",
selectableRowsClass = "info",
Expand Down
6 changes: 3 additions & 3 deletions inst/examples/interaction/ui.R
@@ -1,6 +1,6 @@
library(shiny)
library(htmlwidgets)
library(tableFilter)
library(D3TableFilter)

shinyUI(fluidPage(
title = 'Interactive features',
Expand Down Expand Up @@ -32,7 +32,7 @@ shinyUI(fluidPage(
),
column(width = 5,
h4("mtcars"),
tableFilterOutput('mtcars', height = "2000px")
D3TableFilterOutput('mtcars', height = "2000px")
),
column(width = 5,
h4("Last edits"),
Expand All @@ -58,7 +58,7 @@ shinyUI(fluidPage(
)
),
column(width = 5,
tableFilterOutput('mtcars2', height = "2000px")
D3TableFilterOutput('mtcars2', height = "2000px")
),
column(width = 5,
tableOutput("mtcars2Output")
Expand Down
6 changes: 3 additions & 3 deletions inst/examples/performance/server.R
@@ -1,12 +1,12 @@
library(shiny);
library(htmlwidgets);
library(tableFilter);
library(D3TableFilter);
library(ggplot2);

data(diamonds)

shinyServer(function(input, output, session) {
output$diamonds <- renderTableFilter({
output$diamonds <- renderD3TableFilter({

diamonds <- diamonds[1:input$rows, ];

Expand Down Expand Up @@ -58,7 +58,7 @@ shinyServer(function(input, output, session) {
bgColScales <- list();
}

tableFilter(diamonds, table_Props,
D3TableFilter(diamonds, table_Props,
showRowNames = FALSE,
extensions = c('ColsVisibility', 'ColumnsResizer', 'FiltersRowVisibility'),
bgColScales = bgColScales);
Expand Down
4 changes: 2 additions & 2 deletions inst/examples/performance/ui.R
@@ -1,13 +1,13 @@
library(shiny)
library(htmlwidgets)
library(tableFilter)
library(D3TableFilter)

shinyUI(fluidPage(
title = 'Test tableFilter performance',
fluidRow(
column(width = 2,
selectInput("rows", "Rows", choices = c(100, 500, 1000, 5000, 10000, 30000, 53940), selected = 500, multiple = FALSE),
radioButtons("coloring", "Coloring", choices = c("Yes" = TRUE, "No" = FALSE), selected = FALSE)),
column(width = 10, tableFilterOutput('diamonds'))
column(width = 10, D3TableFilterOutput('diamonds'))
)
))
@@ -1,6 +1,6 @@
HTMLWidgets.widget({

name: "tableFilter",
name: "D3TableFilter",

type: "output",

Expand Down
File renamed without changes.

0 comments on commit d57be94

Please sign in to comment.