5/19/2023 0 Comments Icefaces menuitem hoveroverWhile we may add this functionality in the future, for now, we can only keep track of things that have a Shiny input binding. This is something that is not originally supported in AdminLTE. However, there is no current way to see if the user clicked on one of the items in a dropdown menu. Library(shiny) library(shinydashboard) ui <- dashboardPage( dashboardHeader( dropdownMenuOutput( "menu") ), dashboardSidebar( helpText( "Add another item to the dropdown menu by clicking ", "on the button below"), actionButton( "addItem", "Add another item") ), dashboardBody() ) server <- function(input, output, session) shinyApp(ui, server) It also has an advantage: since you get this input “for free” (i.e. you don’t have to pass an id or configure your app in any special way, other than making sure that your version of shinydashboard is equal or greater to 0.6), you also get bookmarking of this input “for free” (i.e. the bookmarked URL will capture which, if any, menuItem() was expanded and, on restore, it will expand the same one). This is unusual, but it works just as well in this case (since there’s always only one sidebar, at most). This is probably your first encounter with a Shiny input that has a fixed name. (The reason that, at most, only one childfull menuItem() can start expanded is because in AdminLTE, only one thing can be expanded in the sidebar at any one time.) You can also pass in an expandedName, which is how Shiny lets you know which (if any) menuItem() is currently expanded (if expandedName is not provided, Shiny defaults to the vaue of the text argument, without any white space). Instead, at most, one of them can take a startExpanded = TRUE, which tells Shiny to start out with that menuItem() expanded, i.e. revealing all its children. “Childfull” menuItem()s cannot have a tabName or a selected argument (or rather, they can, but this will be completely ignored by Shiny). As you might have noticed by now, childless menuItem()s (and menuSubItem()s) and “childfull”" menuItem()s behave differently and there’s different arguments that apply to either:Ĭhildless menuItem()s/ menuSubItem()s must be given a tabName argument in addition, one of these can have selected = TRUE, which lets Shiny know that you want input$tabs (if you passed in id = "tabs" to sidebarMenu()) to start out with that item’s tabName (if you specified a tabItem() for that tabName, that will what you first see in the dashboard body when you launch your app).
0 Comments
Leave a Reply. |