Comments (1)
Hi,
thanks @saxodel for the nice comments.
I can't say that I have understood completely what's going on. I've fixed one bug in the D3TableFilter javascript preventing the select input from working in a module. Then I modified your example sligthly (see below.). In this version the observer in the server function works, but the reactive in the module doesn't work, even if it is listening to the same input. I guess I need to dig a bit deeper in shiny modules...
Best
# d3tabModule.R
d3tabUI <- function(id) {
ns <- NS(id)
tagList(
column(d3tfOutput(ns('mtcars')), width = 8),
column(tableOutput(ns("mtcarsSelect")), width = 4)
)
}
d3tab <- function(input, output, session, data) {
ns <- session$ns
output$mtcars <- renderD3tf({
tableProps <- list(
btn_reset = TRUE,
rows_counter = TRUE,
rows_counter_text = "Rows: ",
sort = TRUE,
on_keyup = TRUE,
on_keyup_delay = 800,
sort_config = list(
sort_types = c("Number", "Number")
),
filters_row_index = 1,
rows_always_visible = list(nrow(mtcars) + 2),
col_operation = list(
id = list("frow_0_fcol_1_tbl_mtcars","frow_0_fcol_2_tbl_mtcars"),
col = list(1,2),
operation = list("mean","mean"),
write_method = list("innerhtml",'innerhtml'),
exclude_row = list(nrow(mtcars) + 2),
decimal_precision = list(1, 1)
)
);
footData <- data.frame(Rownames = "Mean", mpg = 0, cyl = 0);
d3tf(mtcars[ , 1:2],
enableTf = TRUE,
tableProps = tableProps,
showRowNames = TRUE,
selectableRows = "multi",
selectableRowsClass = "info",
tableStyle = "table table-bordered table-condensed",
rowStyles = c(rep("", 7), rep("info", 7)),
filterInput = TRUE,
footData = footData,
height = 500);
})
mtcarsInput <- reactive({
inputID <- ns("mtcars_select")
print("inputID in mtcarsInput ")
print(inputID)
print(input[[inputID]])
if(is.null(input[[inputID]])) return(NULL)
return(input[[inputID]])
})
# for a output object "mtcars" tableFilter generates an input
# "mtcars_edit".
output$mtcarsSelect <- renderTable({
if (is.null(mtcarsInput())) return(invisible());
mtcarsInput()[ , 1:2];
})
}
# app.R
library(shiny)
library(htmlwidgets)
library(D3TableFilter)
source("d3tabModule.R")
ui <- fluidPage(
d3tabUI("d3tab")
)
server <- function(input, output) {
observe({
print("d3tab-mtcars_select in server")
print(input[['d3tab-mtcars_select']])
})
callModule(d3tab, "d3tab", data(mtcars))
}
shinyApp(ui = ui, server = server)
from d3tablefilter.
Related Issues (20)
- Reproducible example HOT 2
- Hide columns by default and have dropdown cells HOT 1
- No way to reset editions HOT 8
- ctrl + click doesn't work for mac systems HOT 1
- Accessing row data in Shiny HOT 2
- Is there a way to fill an edit down a column? HOT 2
- Pre-select of Rows HOT 2
- Freeze Header Pane When Scrolling
- How to save stand-alone html from R D3TableFilter HOT 1
- ColumnsResizer extension doesn't works HOT 4
- colVisibility extension not showing HOT 9
- Column Editing HOT 1
- Setting Column Width / Resizing Issue
- Scrollbar
- Fixed Table Headers
- R 3.4.3 Compatibility? HOT 1
- Adapting examples/interaction
- paging_length doesn't work
- Filtered table not rendering
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from d3tablefilter.