Giter Club home page Giter Club logo

Comments (12)

jrowen avatar jrowen commented on July 27, 2024

I'm not seeing this error with shiny v0.11.1.

from rhandsontable.

smartinsightsfromdata avatar smartinsightsfromdata commented on July 27, 2024

@jrowen I have v0.11.1.9000 which I believe is the working version where they migrated to jsonlite (they are planning soon to do the same with htmlwidgets).
The above message is particularly annoying as it is generated at every call of jsonlite i.e. twice each time you click on a checkbox, and I couldn't suppress it just with options(warn=-1).

from rhandsontable.

smartinsightsfromdata avatar smartinsightsfromdata commented on July 27, 2024

@jrowen correct: it does not happen with shiny v0.11.1. Nevertheless as the issue is connected to shiny migration to jsonlite will need appropriate tlc...

from rhandsontable.

jrowen avatar jrowen commented on July 27, 2024

Can you post the example that generates an error?

from rhandsontable.

smartinsightsfromdata avatar smartinsightsfromdata commented on July 27, 2024

This is the code (imperfect - it is just for me to test the insurgence of endless loops):

options(warn=-1)
library(rhandsontable)
library(shiny)

options(warn=-1)
quantity <- id <- 1:20
label <- paste0("lab","-",quantity)
pick <- FALSE
iris_ <- data.frame(id=id,pick=pick, quantity=quantity,label=label,iris[1:20,] ,stringsAsFactors = FALSE)

iris_$Species <- NULL
cols <- colnames(iris_)
#---------------------------
ui <- fluidPage(
    fluidRow(
        column(8,rHandsontableOutput('demTb')),
        column(3,uiOutput("demSli"))
        )
    )

server <- function(session, input, output) {


output$demSli <- renderUI({

if(is.null(input$demTb) ) return()

isolate({
df_ <- hot_to_r(input$demTb)
index <- which(df_$pick==T)
if(length(index)==0) return()
labs <- iris_$label[index] 
pages <- "test"
iter <- length(labs)
buttn <- 1
valLabs <- sapply(1:iter, function(i) {
if(is.null(input[[paste0(pages,"d",labs[i],buttn)]] )) {
          0
} else {  as.numeric(input[[paste0(pages,"d",labs[i],buttn)]])  }
}) 
#
toRender <- lapply(1:iter, function(i) {
  sliderInput(inputId = paste0(pages,"d",labs[i],buttn),
              label =  h6(paste0(labs[i],"")),
              min = -100,
              max = 100,
              step = 1,
              value = valLabs[i],
              post="%",
              ticks = FALSE, animate = FALSE)
              })
})
      return(toRender)

})
#--------------------
rds <- reactive({

if( is.null(input$demTb) ) return(iris_)

df_ <- hot_to_r(input$demTb)
isolate({

index <- which(df_$pick==T) 
if(length(index)==0) return(df_)
labs <- iris_$label[index] 
pages <- "test"
iter <- length(labs)
buttn <- 1
}) # end isolate
valLabs <- sapply(1:iter, function(i) {
    if(is.null(input[[paste0(pages,"d",labs[i],buttn)]] )) {
      0
    } else {  
      as.numeric(input[[paste0(pages,"d",labs[i],buttn)]])/100  
    }
  })

  dft_ <- data.frame(label=labs, multi=valLabs, stringsAsFactors = FALSE)
  dft_ <- merge(iris_,dft_,by="label", all.x=T)

  dft_$quantity <- sapply(1:length(dft_$quantity), function(z) {
    if( is.na( dft_$multi[z]) ) { 
    dft_$quantity[z]
  } else { iris_$quantity[z]*(1 + dft_$multi[z]) }
})
dft_[with(dft_,order(as.numeric(id))),]
df_[with(df_,order(as.numeric(id))),]

df_$quantity <- df_$quantity
  return(df_)
  }) 


output$demTb  <-  renderRHandsontable({


if(is.null(rds() )) return()

df_ <- rds() 
df_ <- df_[cols]
df_ <- df_[with(df_,order(as.numeric(id))),]
rhandsontable(df_, readOnly = FALSE, rowHeaders= NULL, useTypes= TRUE) %>%
  hot_table(highlightCol = TRUE, highlightRow = TRUE) %>%
hot_validate_numeric(col = "quantity", min = 0, max = 50, exclude = 40)


})

}

shinyApp(ui, server)

from rhandsontable.

smartinsightsfromdata avatar smartinsightsfromdata commented on July 27, 2024

@jrowen If you could look kindly into this issue - as well as the validator logic issue (by typeof) I would love to test the widget more extensively with the idea to use it in one of my projects.

from rhandsontable.

jrowen avatar jrowen commented on July 27, 2024

I'd prefer to make any necessary updates once a new version of shiny is stable and released.

from rhandsontable.

smartinsightsfromdata avatar smartinsightsfromdata commented on July 27, 2024

@jrowen fair enough - but what about the validator logic issue (by typeof)?

from rhandsontable.

smartinsightsfromdata avatar smartinsightsfromdata commented on July 27, 2024

@jrowen Not sure if you have seen this: ramnathv/htmlwidgets#28 (comment)
htmlwidget is ready to migrate to jsonlite. Sadly I'm really busy this weekend and I do not have much time for testing.
These are the packages you need:

devtools::install_github(c('jeroenooms/jsonlite', 'rstudio/shiny', 'yihui/htmlwidgets@jsonlite'))

from rhandsontable.

smartinsightsfromdata avatar smartinsightsfromdata commented on July 27, 2024

@jrowen I tried the shiny app posted here earlier and I cannot see anything anymore!

from rhandsontable.

jrowen avatar jrowen commented on July 27, 2024

I think we have a fix for the htmlwidgets move to jsonlite.

The informational message mentioned above still appears when a data.frame is passed to the widget. rhandsontable doesn't set the keep_vec_names parameter, so the message may be originating from htmlwidgets or shiny.

from rhandsontable.

yihui avatar yihui commented on July 27, 2024

FYI, I have fixed this issue in my PR #8.

from rhandsontable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.