Skip to content

how to make a ScrollArea autoscroll? #4171

Answered by falkoschindler
8forty asked this question in Q&A
Discussion options

You must be logged in to vote

I found a reference in the quasar discussions from 2 years ago

Great!

This sounds like the "UGLY" fix (with run_javascript...) I posted above, right?

Yes, indeed.

Given the mentioned debounce time of 100ms (or 110ms to be sure), we can implement another ugly solution:

async def add_label():
    with scroll:
        ui.label('Hello')
    await asyncio.sleep(0.11)
    scroll.scroll_to(percent=1)

scroll = ui.scroll_area().classes('w-40 h-40 border')
ui.button('Add', on_click=add_label)

I think my preferred solution would be to simply scroll to a ridiculous number like 1e6:

scroll.scroll_to(percent=1e6)

This works in all cases, there's no delay, and the code is concise and readable - wit…

Replies: 5 comments 13 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
13 replies
@8forty
Comment options

@falkoschindler
Comment options

@8forty
Comment options

@falkoschindler
Comment options

Answer selected by 8forty
@ed2050
Comment options

@falkoschindler
Comment options

@ed2050
Comment options

@falkoschindler
Comment options

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