Questions tagged [shinymodules]

150 questions
8
votes
2 answers

Why do we use session$ns in Shiny modules and not NS(id)?

Consider any Shiny module in which we use session$ns in the server part, e.g. the one below. We could equivalently use NS(id) instead of session$ns. So why it is recommended to use session$ns? Is there an advantage over…
Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225
5
votes
3 answers

editable DT inside shiny module

I would like to have an editable DT inside a shiny module. When I change a value in the DT, then the table updates and it is empty with the message inside the datatable: "No matching records found" My code is as follows: Modules: modDtUi <-…
Francesc VE
  • 762
  • 2
  • 9
  • 19
4
votes
1 answer

How to update shiny module with reactive dataframe from another module

The goal of this module is create a reactive barplot that changes based on the output of a data selector module. Unfortunately the barplot does not update. It's stuck at the first variable that's selected. I've tried creating observer functions to…
ethan tenison
  • 393
  • 3
  • 14
4
votes
1 answer

How to get the selected Tab-ID in a navbarPage with modules

I want to create a navbarPage, where each tabPanel or the tagList of each tabPanel is created in another module. In a "normal" shiny app I would be able to know which Tab is currently selected by using input$navbarPage_ID. (where navbarPage_ID is…
SeGa
  • 9,454
  • 3
  • 31
  • 70
3
votes
1 answer

Dynamic UI/Server Modules in Shiny Dashboard Based on Inputs in UI

Let's say I have 4 sets of UI/Server modules in 4 different directories ("./X1/Y1/", "./X1/Y2/", "./X2/Y1/", "./X2/Y2/"). I want to load the selected set based on the input in the sidebar. I tried using source() within dashboardBody(), but I was not…
3
votes
0 answers

Usage of Modules and stratégie du petit r with navbarPage

I try to understand the usage of modules and stratégie du petit r. I would like to receive feedback if I used the components correctly? Also I'm interested: Does it make sense to structure an application in the way that each tabPanel is 1 Module?…
Leo
  • 51
  • 4
3
votes
1 answer

Data not passed through to module inside modularized shiny tabPanel/navbarPage

My reproducible shiny app creates some data which shall be plotted by calling a plot module using lapply. It, therefore, contains the main app, the modularized Page_ui/Page_server, and the Module_ui/Module_server. It works as a stand-alone app when…
Cevior
  • 97
  • 8
3
votes
2 answers

Shiny modules: Destroy module ui if server-function fails

How to display a blank UI (alternatively destroy module UI), if the module server-function fails, without moving all the UI-code to the server function? Simple reproducible example: library(shiny) my_module_ui <- function(id) { ns <- NS(id) …
Comfort Eagle
  • 2,112
  • 2
  • 22
  • 44
3
votes
1 answer

R shiny - last clicked button id inside shiny module function

I am trying to access the last clicked checkbox or button id from inside a Shiny module. I have found the great response from this post helpful: R shiny - last clicked button id and have adapted the code to my question. I also took a hint from this…
amycookie
  • 43
  • 6
2
votes
1 answer

How to use shiny.setInputValue within a module?

I am using the shinyjs::runjs("Shiny.setInputValue(...)) command to get the innerText value of the 'calendar_renderRange' span of the toastui calendar widget. The command is working in a non modularized app context but not in a modularized app…
2
votes
1 answer

Separate the `renderUI` in a module server

In some complex and large shiny apps, the UI parts are often rendered with renderUI and uiOutput. Consider this small app for illustration: library(shiny) modUI <- function(id) { ns <- NS(id) uiOutput(ns("theUI")) } modServer <- function(id)…
Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225
2
votes
1 answer

Calling shiny module a second time creates second observeEvent

sorry if this is a simple question, but I am quite new to Shiny and even newer to using Modules. I have a larger application in which one of its pages I use a button to open a Shiny Modal, there are quite a few things going on in this modal, so I…
aaa
  • 63
  • 3
2
votes
1 answer

Creating navbarMenu and tabPanel using shiny modules

I want to create a shiny app that uses navbarMenu() and tabPanel() to display data tables. Instead of writing all of the codes in one app.R file, I plan to use the concept of shiny modules creating R/tabUI.R and R/tabServer.R to generate these…
Yao-Chung
  • 69
  • 4
2
votes
1 answer

how to avoid flickering while refreshing valueboxes in Shiny dashboard

I use shiny modules to update a large number of value boxes. The annoying part is the value boxes donot seem to scale above 10 or 20 as their updating is causing annoying flickers. Even those boxes whose values are not changing on the next…
Lazarus Thurston
  • 1,197
  • 15
  • 33
2
votes
2 answers

Shiny modules: switch tabs from within modules that have different namespaces

I have a shiny app with multiple tabs, and I would like to have action buttons within the tabs that allow the user to switch tabs. I previously asked this question: R Shiny: Change tabs from within a module and got an answer that helped, but didn't…
tamarack
  • 377
  • 1
  • 11
1
2 3
9 10