jQWidgets Forums

jQuery UI Widgets Forums Lists ListBox Maintain scroll position

This topic contains 3 replies, has 3 voices, and was last updated by  bobsov 11 years, 5 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Maintain scroll position #21351

    Terry Foster
    Participant

    Here’s my situation. I’m populating my list box with items that have a number of visual aspects that can change dynamically when the user performs certain operations in our application. I achieve this by setting the ‘source’ property of the list box with an array of objects that specify the ‘html’ to use for each item in the list. Whenever the user does something that affects the appearance of my items, I rebuild and set the ‘source’ of my list box with the updated item html. Doing so, however, causes the list box to always scroll back to the top of the list if I happen to have lots of items and I’m scrolled down. This is very inconvenient for our users. Can you suggest some ways I can maintain the exact scroll position? I know the list box has the function ‘ensureVisible’, but I don’t think that can be leveraged to keep the exact same scroll position, besides which it just didn’t seem to work for me – not sure why. Is there a way to control the scroll position directly, or is there a better way to update the item html without having to rearrange the entire list box (the number of items, nor the item height, will ever change).

    Thanks,
    Terry

    Maintain scroll position #21357

    Peter Stoev
    Keymaster

    Hi Terry,

    In the current implementation, If you set the “source” property of the ListBox, then it will reset its scroll position, too. Unfortunately, we do not have public API for setting the exact scroll position. It is only possible to bring an item into view by using the “ensureVisible” method, but it seems that you already know about it. I will add a work item for adding API that will enable you to Get and Set the Scrolls position.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Maintain scroll position #21359

    Terry Foster
    Participant

    That would be great. Thank you.

    Terry

    Maintain scroll position #32300

    bobsov
    Member

    Was there ever a solution API for this one?

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.