Comments (8)
Alas, bumping from v0.2.0. Sys.sleep()
didn't play nice with interactivity. Seems like we probably need to use a more typical javascript event workflow to do this. Will tackle in a future version.
from datadigest.
There are a few steps to figure out.
- Once the files tab is drawn server.R add the buttons to the tab (this isn't done by the javascript library)
- When a button is clicked, the file or files should be added to the files table (this requires passing info from client -> server -> client)
from datadigest.
A few (possibly) helpful links:
- https://groups.google.com/d/msg/shiny-discuss/cs8qx3Ato0I/pvXlSXjgDwAJ
- https://shiny.rstudio.com/articles/html-ui.html
from datadigest.
Pretty sure we want to use observeEvent()
for these. This example is close, but we need to trigger on a custom js from codebook.js ("renderComplete" or whatever we choose to call it) instead of a named input (input$go
):
shinyApp(
ui = basicPage(actionButton("go", "Go")),
server = function(input, output, session) {
observeEvent(input$go, {
insertUI("#go", "afterEnd",
actionButton("dynamic", "click to remove"))
# set up an observer that depends on the dynamic
# input, so that it doesn't run when the input is
# created, and only runs once after that (since
# the side effect is remove the input from the DOM)
observeEvent(input$dynamic, {
removeUI("#dynamic")
}, ignoreInit = TRUE, once = TRUE)
})
}
)
}
EDIT: No longer convinced observeEvent() is the way to go. Not clear to me if you can trigger this based on an output changing state, or if it has to be an input. Not able to find an example where this triggers on an arbitrary js event (although seems like it should be doable ...)
from datadigest.
This looks like a good option for js -> R -> js rendering. Can be used to trigger an update in the files table once a new file is added.
from datadigest.
And this might be the way to add content after the initial loads. Can be used to add the file upload buttons after the explorer Shiny output is validated.
from datadigest.
Simple implementation of part #1 ("Once the files tab is drawn server.R adds the buttons to the tab") done like so:
Sys.sleep(1)
insertUI(
selector="div.explorer div.instructions.section",
where="beforeEnd",
ui=fileInput('datafile','Upload a file',accept = c('.sas7bdat','.csv'))
)
Need to add in some of bootstrap's CSS to make it look decent and would be better to trigger on a call back, but all things considered, waiting for a second works reasonably well ...
from datadigest.
One is basically good to go. Going to create separate issues for part 2 below:
- Once the files tab is drawn server.R add the buttons to the tab (this isn't done by the javascript library)
- When a button is clicked, the file or files should be added to the files table (this requires passing info from client -> server -> client)
from datadigest.
Related Issues (20)
- Demo files always shown on initial load
- Producing an html from Hmisc (within codebookApp) generates warnings in console
- Selection of data file under explorer's "Files" tab produces web error HOT 4
- wiki images HOT 2
- Allow user to pass a settings object to codebook() or explorer() HOT 1
- Mysql integration HOT 3
- Appropriate handling of missing values
- Explorer does not recognize dataset names in a specific case
- Convert dates to character before rendering
- Support additional file formats for upload in shiny app
- Add support for custom filtering in Shiny app HOT 1
- Document basics of html widget bindings
- Add link to vingette in readme.md
- Do not show duplicate datasets in explorer
- if demo = TRUE in explorer(), force addEnv = FALSE
- explorer() with addEnv=TRUE will not autoload data frames named "a" or "c"
- Update to newest web-codebook v1.6 ... HOT 1
- Manuscript link does not work. HOT 1
- R Studio session runs out when reading big DF HOT 1
- Add pkgdown site
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 datadigest.