1. #1
    Sencha User
    Join Date
    Jul 2012
    Posts
    3
    Vote Rating
    0
    endre.balogh is on a distinguished road

      0  

    Default Unanswered: VerticalLayoutContainer scroll to bottom

    Unanswered: VerticalLayoutContainer scroll to bottom


    Hello,

    I'm trying to add a list of items to a VerticalLayoutContainer over some time and scroll the container to the bottom after each item, so that the last item is always visible.
    However, the container always scrolls to the item before the last, i.e. after adding the 4th item, it scrolls to the 3rd.
    I tried to call .scrollToBottom() immediately after adding the widget:

    Code:
    VerticalLayoutContainer conversationContainer;
    ...
    final ScrollSupport scrollSupport = conversationContainer.getScrollSupport();
    ...
    conversationContainer.add(conversationWidget); 
                    scrollSupport.scrollToBottom();
    And placing the call into an AddHandler:

    Code:
    conversationContainer.addAddHandler(new AddEvent.AddHandler() {
                
                @Override
                public void onAdd(AddEvent event) {
                    scrollSupport.scrollToBottom();
                }
            });
    What is the correct way to implement this behavior?

  2. #2
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    What happens if you interact directly with the VLC's XElement? I.e., conversationContainer.getElement().

    There are several .scrollXXX methods on the element as well as getScrollXXX() methods.

  3. #3
    Sencha User
    Join Date
    Jul 2012
    Posts
    3
    Vote Rating
    0
    endre.balogh is on a distinguished road

      0  

    Default


    Hi,

    I tried the following:

    Code:
    ConversationWidget conversationWidget = new ConversationWidget(next);
    conversationContainer.add(conversationWidget);
    Code:
    conversationWidget.getElement().scrollIntoView();
    Code:
    conversationWidget.getElement().scrollIntoView(conversationContainer.getElement(), false);
    Code:
    conversationContainer.getElement().scrollTo(ScrollDirection.TOP, conversationWidget.getElement().getTop());
    These all scroll the previous widget into view, just like the code in my first post.

    Code:
    conversationContainer.getElement().scrollIntoView();
    This scrolls the container into view.

    I was thinking that I'm referring to the wrong widget while scrolling, but I included some logging and it all seems OK.

  4. #4
    Ext GWT Premium Member icfantv's Avatar
    Join Date
    Sep 2011
    Location
    Superior, CO
    Posts
    411
    Answers
    20
    Vote Rating
    21
    icfantv will become famous soon enough icfantv will become famous soon enough

      0  

    Default


    Well, it certainly appears that ScrollSupport delegates to the underlying XElement.

    What if you try a lighter weight layout container? Try a FlowLayoutContainer - if it looks funky, ensure that the children have a size.

  5. #5
    Sencha User
    Join Date
    Jul 2012
    Posts
    3
    Vote Rating
    0
    endre.balogh is on a distinguished road

      0  

    Default


    Using FlowLayoutContainer results in the same behavior.

    I eventually devised a workaround, by adding an additional iteration that scrolls the container to the bottom, after the last element has been added. It works almost as intended

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar