Skip to content
Discussion options

You must be logged in to vote

The trick is to move the refreshable out of the page creator function as shown in our chat app example. The refreshable tracks every registered client and updates accordingly:

columns = [
    {"name": "name", "label": "Name", "field": "name"},
    {"name": "age", "label": "Age", "field": "age"},
]
rows = [{"name": "Alice", "age": 20}, {"name": "Bob", "age": 30}, {"name": "Carol", "age": 40}]


# when data comes in, call refresh on all registered table functions
def incoming_data(record: dict) -> None:
    rows.append(record)
    mytable.refresh()


@ui.refreshable
def mytable(ui_state: dict) -> None:
    def refresh_selection(table) -> None:
        table.selected.clear()
        selected…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by kleynjan
Comment options

You must be logged in to vote
0 replies
Comment options

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

@kleynjan
Comment options

kleynjan Mar 20, 2025
Author Sponsor

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants