Replies: 2 comments 4 replies
-
Sorry @linkwww8 we do not have a ready-made solution for your use case. But scrolling to the bottom of a page is implemented in our chat app example: nicegui/examples/chat_app/main.py Line 15 in 0994ca6 Maybe you can adapt this? |
Beta Was this translation helpful? Give feedback.
1 reply
-
According to https://stackoverflow.com/a/55768729 it should be possible to do "scroll-to-bottom" with def add():
item = os.urandom(10 // 2).hex()
table.add_rows({'id': item, 'count': random.randint(0, 100)})
table.run_method('scrollTo', len(table.rows)-1)
ui.button('add', on_click=add)
columns = [
{'name': 'id', 'label': 'ID', 'field': 'id'},
{'name': 'count', 'label': 'Count', 'field': 'count'},
]
table = ui.table(columns=columns, rows=[], row_key='id').classes('w-full h-96').props('virtual-scroll')
for _ in range(30):
add() Basically you need to enable |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Question
Big thxs to NiceGUI team for making a great tool!
Trying to find a way to scroll to the latest (appended) row with a ui.table or ui.aggrid. I've tried looking into 'scrollTo' but had no luck...
Using code kindly shared here (#408) by @phoskee to read new rows in from a file via csv.DictReader. Nothing fancy, simply using a ui.aggrid with an update button. But when clicked, table jumps back to top every time (update()).
Side note: I believe this method is the preferred option rather than from_pandas(df) which doesnt have an update_from_pandas() feature yet. Unsure if that info is still correct @falkoschindler , but tell me if there is a improved way lol.
Beta Was this translation helpful? Give feedback.
All reactions