Skip to content

Unable to get Table pagination working in a multipage app #2048

Answered by mturoci
htailor asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @htailor, good question!

TLDR

If using @on mechanism, you need to use it for everything.

Working code

from h2o_wave import main, app, Q, ui, on, handle_on, data
from typing import Optional, List


# Remove all the cards related to navigation.
def clear_cards(q, ignore: Optional[List[str]] = []) -> None:
    if not q.client.cards:
        return
    for name in q.client.cards.copy():
        if name not in ignore:
            del q.page[name]
            q.client.cards.remove(name)


rows = [str(i + 1) for i in range(100)]
rows_per_page = 10

@on('#page1')
async def page1(q: Q):
    clear_cards(q)  # When routing, drop all the cards except of the main ones (header, sidebar, meta).

    q.

Replies: 1 comment 1 reply

Comment options

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

Answer selected by htailor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants