Use orderInput in Table & module
emantzo opened this issue · comments
emantzo commented
I am having some difficulties in using orderInput to define formulas in aTable.
Would you please check my SO question?
Many thanks!!
Yang Tang commented
Hi @emantzo , this is related to a bug of shinyjqui, which was fix just now in 948af5e. Now you can use the reset button like this:
library(shiny)
library(shinyjqui)
ui <- fluidPage(
orderInput("ops", "Operators", c("~", "+", "*"),
as_source = T, connect = "formula",
item_class = "primary"),
orderInput("var", "Variables", c("x", "y", "z"),
as_source = F, connect = "formula",
item_class = "default",
placeholder = "(blank)"),
orderInput("formula", "Formula", items = NULL,
as_source = F, connect = NULL, placeholder = "(build your formula)"),
verbatimTextOutput("myFormula"),
actionButton("reset", "Reset")
)
server <- function(input, output, session) {
# on page load, save the two orderInput
jqui_sortable("#var,#formula", operation = "save")
observeEvent(input$reset, {
jqui_sortable("#formula,#var", operation = "load")
})
output$myFormula <- renderPrint({
paste0(input$formula, collapse = " ")
})
}
shinyApp(ui, server)
emantzo commented
Thanks a lot for the reply!
I tried it and I noticed that when I use the Reset button the "operators" are not removed from the formula.
Also, is there any option to select and remove only certain items from the formula?
…________________________________
From: Yang Tang <notifications@github.com>
Sent: Sunday, August 23, 2020 5:10 PM
To: Yang-Tang/shinyjqui <shinyjqui@noreply.github.com>
Cc: emantzo <emantzo@hotmail.com>; Mention <mention@noreply.github.com>
Subject: Re: [Yang-Tang/shinyjqui] Use orderInput in Table & module (#70)
Hi @emantzo<https://github.com/emantzo> , this is related to a bug of shinyjqui, which was fix just now in 948af5e<948af5e>. Now you can use the reset button like this:
library(shiny)
library(shinyjqui)
ui <- fluidPage(
orderInput("ops", "Operators", c("~", "+", "*"),
as_source = T, connect = "formula",
item_class = "primary"),
orderInput("var", "Variables", c("x", "y", "z"),
as_source = F, connect = "formula",
item_class = "default",
placeholder = "(blank)"),
orderInput("formula", "Formula", items = NULL,
as_source = F, connect = NULL, placeholder = "(build your formula)"),
verbatimTextOutput("myFormula"),
actionButton("reset", "Reset")
)
server <- function(input, output, session) {
# on page load, save the two orderInput
jqui_sortable("#var,#formula", operation = "save")
observeEvent(input$reset, {
jqui_sortable("#formula,#var", operation = "load")
})
output$myFormula <- renderPrint({
paste0(input$formula, collapse = " ")
})
}
shinyApp(ui, server)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#70 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AICLAPUKZQ6KS263ZS4SZR3SCEPOFANCNFSM4QFOTDOQ>.
Yang Tang commented
You need to install the newest github version of shinyjqui in which I fixed the bug. To remove certain items, you may try the updateOrderInput
function.
emantzo commented
Thank you for your reply.
Regarding removing items from the formula, I would like to ask if this is possible to do by dragging them out of the formula.
…________________________________
From: Yang Tang <notifications@github.com>
Sent: Sunday, August 23, 2020 5:10 PM
To: Yang-Tang/shinyjqui <shinyjqui@noreply.github.com>
Cc: emantzo <emantzo@hotmail.com>; Mention <mention@noreply.github.com>
Subject: Re: [Yang-Tang/shinyjqui] Use orderInput in Table & module (#70)
Hi @emantzo<https://github.com/emantzo> , this is related to a bug of shinyjqui, which was fix just now in 948af5e<948af5e>. Now you can use the reset button like this:
library(shiny)
library(shinyjqui)
ui <- fluidPage(
orderInput("ops", "Operators", c("~", "+", "*"),
as_source = T, connect = "formula",
item_class = "primary"),
orderInput("var", "Variables", c("x", "y", "z"),
as_source = F, connect = "formula",
item_class = "default",
placeholder = "(blank)"),
orderInput("formula", "Formula", items = NULL,
as_source = F, connect = NULL, placeholder = "(build your formula)"),
verbatimTextOutput("myFormula"),
actionButton("reset", "Reset")
)
server <- function(input, output, session) {
# on page load, save the two orderInput
jqui_sortable("#var,#formula", operation = "save")
observeEvent(input$reset, {
jqui_sortable("#formula,#var", operation = "load")
})
output$myFormula <- renderPrint({
paste0(input$formula, collapse = " ")
})
}
shinyApp(ui, server)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#70 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AICLAPUKZQ6KS263ZS4SZR3SCEPOFANCNFSM4QFOTDOQ>.