Python shiny qgrid working only under strange circumstances

If I run this code, output_widget("widget_df") which should display a qgrid table produces nothing.... But if I add another identical qgrid widget widget_df2, elsewhere in the app both show.

Here's the code where I don't get a qgrid table



from shiny import App, ui, reactive, render
from htmltools import HTML, div
import qgrid
import seaborn as sn

data = sn.load_dataset("tips")


from shiny import App, ui, reactive, render
from htmltools import HTML, div
import qgrid
import seaborn as sn
from shinywidgets import output_widget, render_widget


data = sn.load_dataset("tips")

app_ui = ui.page_navbar(
       ui.nav("Part1", 
              ui.layout_sidebar(ui.panel_sidebar(
                 "Test"), 
                                ui.panel_main(
                                    ui.navset_tab(
                                        ui.nav("Summary",
 #this output widget on its own doesn't show up
                                             output_widget("widget_df")
                                    ),
                                        ui.nav("Test2", 
                                               "blank"),
                                        
                                        
                                        
                                        id="main_panel"
                                    )
                                    )
                                )
              ),
       ui.nav('Part2', "blank"),
       title = "App"
       
        )



def server(input, output, session):
    
    @output
    @render_widget
    def widget_df():
        return qgrid.show_grid(data)
    
    
app = App(app_ui, server)

And when I just add in a second widget they both show.

from shiny import App, ui, reactive, render
from htmltools import HTML, div
import qgrid
import seaborn as sn
from shinywidgets import output_widget, render_widget


data = sn.load_dataset("tips")

app_ui = ui.page_navbar(
       ui.nav("Part1", 
              ui.layout_sidebar(ui.panel_sidebar(
                 "Test"), 
                                ui.panel_main(
                                    ui.navset_tab(
                                        ui.nav("Summary",
                                             output_widget("widget_df")
                                    ),
                                        ui.nav("Test2", 
                                               "blank"),
                                        
                                        
                                        
                                        id="main_panel"
                                    )
                                    )
                                )
              ),
#adding in this second widget, now both widgets show.
       ui.nav('Part2', output_widget("widget_df2")), 
       title = "App"
       
        )



def server(input, output, session):
    
    @output
    @render_widget
    def widget_df():
        return qgrid.show_grid(data)
    
    @output
    @render_widget
    def widget_df2():
        return qgrid.show_grid(data)
    

app = App(app_ui, server)

Wtf could be going on?

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.