-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
logical value and checkbox #18
Comments
@trestletech This is the same problem as this one #8 I investigated the reason: the logic you use to build the deltas to send to handsontable uses a matrix, which converts everything to text including the logic / picker datatypes. |
I'm testing a pull request #15 that includes some additional logic around maintaining |
@jrowen It does not work. tbl1 <- data.frame(num1=1:rows,
num2=(1:rows)*20,
letter=LETTERS[1:(rows)],
select=FALSE,
stringsAsFactors=F) I'll keep investigating but I would appreciate if you could have a look as well. Thanks! |
If you are using the |
@jrowen Ah! Let me try with |
@jrowen It does not work: see attached sample file. Basically if a number of checkbox are picked only the last one is returned by shiny... library(shiny)
suppressWarnings(suppressMessages(library(shinyTable)))
library(data.table)
# options(shiny.trace = T) # change to T for trace
# options(shiny.reactlog=TRUE)
##
# source(paste0(".","/","global.R"), echo=FALSE)
##
a <- "Test"
dt_ <- data.frame( val = as.numeric(11:22) , value = 1:12,
vals = 31:42, months= month.abb, select = F )
##
runApp(list( ui = fluidPage(
fluidRow(column(6, htable("hdtable2",colHeaders = "provided", setColTypes = TRUE)),
column(3,uiOutput("outSel")) )
),
server = function(input, output, session) {
output$hdtable2 <- renderHtable({
if (length(input$hdtable2)==0) {
hdtable2 <- dt_
return(hdtable2)
}
})
output$outSel <- renderUI({
if (length(input$hdtable2)==0) { return() }
dt1 <- data.table(input$hdtable2)
picked <- as.vector(unlist(unique(dt1[dt1$select==T,months])))
if(length(picked)==0) { return() }
buttn <- 1
iter <- length(picked)
valsTv <- sapply(1:iter, function(i) {
if(is.null(input[[paste0(month.abb[i],"-","a",buttn)]])) {
0
} else {
as.numeric(input[[paste0(month.abb[i],"-","a",buttn)]])
}
})
toRender <- lapply(1:iter, function(i) {
sliderInput(inputId = paste0(month.abb[i], "-","a",buttn),
label = h6(paste0(month.abb[i],"")),
min = -100,
max = 100,
step = 1,
value = as.numeric(valsTv[i]) ,
post="%",
ticks = FALSE, animate = FALSE)
})
# print(toRender)
return(toRender)
})
# }
}))
# |
If I start with the Take a look at the caching logic in the example--you may need to add something similar to your code. |
@jrowen Many thanks for the help so far: you are right: the logic values perform all right. On the other hand (unless I' m again missing the wood for the trees) shinyTable seems to have issues to update the table. library(shiny)
library(shinyTable)
options(shiny.trace = T)
#' Define server logic required to generate simple table
#' @author Jeff Allen \email{jeff@@trestletech.com}
shinyServer(function(input, output, session) {
cachedMat <- NULL
cachedDf <- NULL
output$df <- renderHtable({
if (is.null(input$df) && is.null(cachedDf)){
rows <- 5
# Seed the element with some data initially
tbl <- data.frame(round(matrix(rnorm(rows^2), ncol=rows), 5))
colnames(tbl) = paste0("B", 1:5)
tbl[, 5] = FALSE
cachedDf <<- tbl
#print(tbl)
return(tbl)
} else if (!is.null(input$df)) {
cachedDf <<- tbl <- input$df
tbl[1,1] <- tbl[1,1]+1
#print(input$df)
return(tbl)
}
})
}) |
I just pushed another update that should fix the problem. Let me know if you're still running into trouble. |
@jrowen - thanks for the great works!!. Just two issues to report (after significant testing):
Error in orig(name = name, shinysession = self) :
attempt to apply non-function
if(is.null(input$shinyTable)) { return()} For example, referring to the code I posted 6 days ago with dynamic sliders, if I decide the first time to render the table with the column "select" equals to TRUE (e.g. to get all the sliders out at the same time), I would expect the dyn. sliders code to fire immediately after the table is rendered, realising that all the checkbox are selected and render immediately all of the sliders. |
In this case, I believe you need to use
|
@jrowen just marvellous!! Do you have an opinion about the issue with the current dev. version of shiny? |
You could try building the branch under my fork.
|
@jrowen This is what I've been doing (once I understood how to!). You rock!
|
Everything appears to be working with the released version of |
@jrowen Your suggestion was spot on: I reported it to the shiny guys. Here is their comment rstudio/shiny#752 |
@jrowen On the other hand the change Wch suggests seems to cause other issues. Have you tried it on the |
I too ran into another error after making the suggested change. It sounds On Wed, Mar 4, 2015 at 1:24 PM Enzo [email protected] wrote:
|
@jrowen Would you kindly contact me on my email please < enzo at smartinsightsfromdata doc com >? Thanks |
Hello,
My dataframe has a column
c(TRUE,TRUE,TRUE)
. When I render this dataframe withrenderHtable
andhtable
there is a checkbox in each cell and it is nice. But when I uncheck one box I get#bad value#
in the rendering.The text was updated successfully, but these errors were encountered: