Table back/forward button support (hash routing?) #1625
-
I have a table where you can click on a row, and you get information about that row. I have added a "Back" button on information-page, and that works. But I would like to let the user also press back button in thir browser (or with their mouse), but since the url dont change that takes them back to the page they were before they entered my page. I guess hash-routing can help here(?), but is there any way to add the hash route when a row is pressed in the table? Is there any other way to make the back-button-in-the-browser work? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
If you want to display a non-interactive table of information, use a markdown table with hash routing. Otherwise for @on('#{hash:str}')
async def print_clicked_cell(q: Q, hash: str):
q.page['form'] = ui.form_card(box='1 1 -1 10', items=[
ui.text(f'Information page: {hash}'),
ui.button(name='back', label='Back'),
]) Screen.Recording.2022-09-19.at.01.33.06.mov |
Beta Was this translation helpful? Give feedback.
-
@marek-mihok awsome, thanks! |
Beta Was this translation helpful? Give feedback.
If you want to display a non-interactive table of information, use a markdown table with hash routing.
Otherwise for
ui.table
you can set column cell type to markdown withcell_type=ui.markdown_table_cell_type()
property. In markdown you can use hash routing by passing a row cell value in the following format:'[cell text content](#my-hash)'
. Then you can use event handlers for showing the information page:Screen.Recording.2022-09-19.at.01.33.06.mov