For the examples, especially those in the documentation, using this Shiny format might make it easier for a user to try or explore. Here is an example with the basic app.
# --------------------------------------------------------
# Minimal shiny app demonstrating the D3TableFilter widget
library(shiny)
library(htmlwidgets)
library(D3TableFilter)
data(mtcars)
# ui.R
# --------------------------------------------------------
ui <- shinyUI(fluidPage(
title = 'Basic usage of D3TableFilter in Shiny',
fluidRow(
column(width = 12, d3tfOutput('mtcars'))
)
))
# server.R
# --------------------------------------------------------
server <- shinyServer(function(input, output, session) {
output$mtcars <- renderD3tf({
# Define table properties. See http://tablefilter.free.fr/doc.php
# for a complete reference
tableProps <- list(
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)))
)
);
d3tf(mtcars,
tableProps = tableProps,
showRowNames = TRUE,
tableStyle = "table table-bordered");
})
})
runApp(list(ui=ui,server=server))
For the examples, especially those in the documentation, using this Shiny format might make it easier for a user to try or explore. Here is an example with the basic app.