Skip to content

Passing data from one to another ui.page #3203

Closed Answered by falkoschindler
wurstcasesenario asked this question in Q&A
Discussion options

You must be logged in to vote

You can add a parameter browser_id to the refreshable that is set during its initial call and omitted when calling .refresh():

numbers = []

@ui.page("/append/{number}")
def append(number):
    numbers.append(number)  # data is the Laptops sessionid, send by the Arduino
    refreshable.refresh()

@ui.page("/")
def overview():
    ui.label(f'ID: {app.storage.browser["id"]}')

    @ui.refreshable
    def render(browser_id: str):
        ui.label(f'ID: {browser_id}')
        for number in numbers:
            ui.label(f'{number == browser_id}')
    render(app.storage.browser["id"])
    global refreshable
    refreshable = render

Note that I renamed some things in your code to better understa…

Replies: 4 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@ed2050
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@falkoschindler
Comment options

Answer selected by wurstcasesenario
@wurstcasesenario
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
community question A question for the NiceGUI community
3 participants