Skip to content

Instantly share code, notes, and snippets.

@richarddmorey richarddmorey/index.Rmd
Last active Nov 29, 2017

Embed
What would you like to do?
example for shinyjs
---
runtime: shiny
---
```{r echo=FALSE, message=FALSE, warning=FALSE}
require(shinyjs)
useShinyjs(rmd=TRUE)
observe({
updateTextInput(session, 'ID', value = "Updated.")
disable('ID')
})
textInput("ID", label = "ID:", width = "150px", placeholder = "ID", value = "Not updated.")
```
---
title: "Test session variables"
output:
flexdashboard::flex_dashboard:
orientation: row
runtime: shiny
---
```{r}
require(flexdashboard)
require(shinyjs)
useShinyjs(rmd=TRUE)
```
```{r}
observe({
query = getQueryString()
ID = query[['ID']]
active = query[['IDactive']]
if (!is.null(ID)) {
updateTextInput(session, 'ID', value = ID)
}
if(!is.null(active)){
if(active == '0'){
disable('ID')
}
}
})
```
Column {.sidebar}
-----------------------------------------------------------------------
```{r}
textInput("ID", label = "ID:", width = "150px", placeholder = "ID", value = "hi")
```
Row {data-height=60}
------------------------------------
### Other
Row
-------------------------------------
### Query string
```{r}
renderUI({
query <- getQueryString()
return(HTML(jsonlite::toJSON(query)))
})
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.