Giter VIP home page Giter VIP logo

Comments (4)

ramnathv avatar ramnathv commented on July 17, 2024 1

I just committed a change that enables conditional sidebars with tabs. The current implementation ties the sidebar ui to a particular tab. I will export module_tabs and module_tabs_ui that will make it easier to support conditional sidebars that are common to all tabs on the page.

Let me know any feedback/comments you have after you try it out!

from shinybones.

dgrtwo avatar dgrtwo commented on July 17, 2024

While the sidebar shows up now, I find I'm not able to access any inputs from the sidebar when it's in a tab. I'm guessing this is because it's not choosing the right namespace for the sidebar UI.

Minimal example:


test <- function(input, output, session, data_global = list(),
               input_global = list(), ...){
  ns <- session$ns
  
  output$histogram <- renderPlot({
    mtcars %>%
      filter(wt > input$min_weight) %>%
      ggplot(aes(mpg)) +
      geom_histogram()
  })
}


#' @rdname xp
test_ui <- function(id, data_global, ...){
  ns <- shiny::NS(id)
  shiny::fluidRow(
    plotOutput(ns("histogram"))
  )
}

#' @rdname xp
test_ui_sidebar <- function(id, data_global, ...){
  ns <- shiny::NS(id)
  
  sliderInput(ns("min_weight"), "Minimum Weight",
             min = 1, max = 5, value = 3)
}

It works fine when _site.yml has:

  - text: Test
    text: test
    module: test

But if it's moved into a tab, the sidebar still shows up but input$min_weight is NULL:

  - text: Test
    tabs:
      - text: test
        module: test

from shinybones.

ramnathv avatar ramnathv commented on July 17, 2024

Thanks for the detailed reprex! It was an issue with the namespace. I just pushed a fix and have tested that your example works. Let me know if it works for you.

from shinybones.

ramnathv avatar ramnathv commented on July 17, 2024

I have confirmed that it works now. Closing this!

from shinybones.

Related Issues (7)

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.