Git Product home page Git Product logo

Comments (3)

YongbingDing avatar YongbingDing commented on July 28, 2024

from shinydashboard.

gadenbuie avatar gadenbuie commented on July 28, 2024

You can include the example by placing it inside a code block delimited by four backticks ````. You can copy the template below and then paste in your Rmd contents.

````
---
title: My rmd
---

# My Rmd

```{r}
library(tidyverse)
```
````

from shinydashboard.

victordebuen avatar victordebuen commented on July 28, 2024

Thanks a lot, @gadenbuie

Here you can see how under RMarkdown there is no ìnput$tags object at all, which should respond to menu events.

Captura desde 2024-05-31 10-45-35

This is the RMarkdown code with which I can't see any value of input$tabs. I used textInput``` and updateTextInputinside an observe because thetextOutput text is white and not visible on the sideBar. I have added an ````invalidateLater to the ````observe`` so that it is clear that it does not react at all to menu item selection.

---
output: html_document
runtime: shiny
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
library(shiny)
library(shinydashboard)
library(tidyverse)
```

```{r ui, echo=FALSE, context="server"}
dashboardPage(
  dashboardHeader(), 
  dashboardSidebar(
    sidebarMenu(
      # Setting id makes input$tabs give the tabName of currently-selected tab
      id = "tabs",
      
      menuItem("Dashboard", tabName = "dashboard"),
      menuItem("Widgets", tabName = "widgets"),
      menuItem("Charts",
               menuSubItem("Sub-item 1", tabName = "subitem1"),
               menuSubItem("Sub-item 2", tabName = "subitem2")
      )
    ),
    textInput("res", label="You have selected", value = "You've selected: 'NONE'")
  ),
  dashboardBody(
    tabItems(
      tabItem("dashboard", "Dashboard tab content"),
      tabItem("widgets", "Widgets tab content"),
      tabItem("subitem1", "Sub-item 1 tab content"),
      tabItem("subitem2", "Sub-item 2 tab content") 
    )
  )
)
```

```{r server, echo=FALSE, context="server"}
  observe({
    invalidateLater(1000)
    list_of_inputs <- reactiveValuesToList(input)
    cat("TRACE Shiny inputs:\n"); print(names(list_of_inputs))
    if(is.null(input$tabs)) {
      tag = "NULL"
    } else {
      tag = paste0("'",input$tabs,"'")  
    }
    updateTextInput(session, "res", value = paste0("At '",strftime(Sys.time(),"%H:%M:%S"),"' tag: ",tag))
  })

from shinydashboard.

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.