javascript - Test vector length (JS) for use with conditional panel (Shiny R) -
i'm trying create conditional panel in shiny based on length of input (character string) vector. specifically, have fileinput widget (e.g. id = filewidget), , want render conditional panel if number of uploaded files <= 1. don't speak javascript, conditional written in r like:
conditionalpanel(condition = input$filewidget$name <= 1 , ...) hopefully straightforward question familiar js. in advance.
i found expression put in conditionalpanel make work.
runapp(shinyapp( ui = fluidpage( fileinput("files","sdfsd", multiple = true), conditionalpanel("$('#files')[0].files.length <= 1", p("<= 1 files selected")) ), server = function(input, output, session) { } )) however, it's little awkward because doesn't use usual shiny condition format of "input.files...", , instead i'm using jquery condition. don't know if shiny devs fine or if they'll it's bad. files handled in weird way in shiny , using input.files.files.length doesn't seem work, that's why had revert jquery
Comments
Post a Comment