ThomasSiegmund / D3TableFilter

A table widget based on Max Guglielmi's "HTML Table Filter Generator" and D3.js
Other
65 stars 17 forks source link

paging_length doesn't work #29

Open jwang-lilly opened 6 years ago

jwang-lilly commented 6 years ago

Hi, Great package.

For some reason, the paging_length doesn't work. Following is a minimal example. You can also use the example "performance" provided in the examples coming with the package.

library(shiny) library(htmlwidgets) library(D3TableFilter)

data(mtcars);

ui <- fluidPage( title = 'Basic usage of D3TableFilter in Shiny', fluidRow( column(width = 12, d3tfOutput('mtcars', height = "auto")) ) )

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,
  paging = TRUE,
  paging_length = 5,
  results_per_page = JS("['Rows per page', [5, 20]]"),
    # alphabetic sorting for the row names column, numeric for all other columns
    col_types = c("string", rep("number", ncol(mtcars)))
);

d3tf(mtcars,
     tableProps = tableProps,
     extensions = list(
      list(name = "sort")
     ),
     showRowNames = TRUE,
     tableStyle = "table table-bordered");

}) })

runApp(list(ui = ui, server = server))