Results 1 to 2 of 2

Thread: How do I know whether a scroller need to scroll?

  1. #1
    Sencha User Ethan Long's Avatar
    Join Date
    Feb 2012
    Posts
    70
    Answers
    2
    Vote Rating
    1
      0  

    Default Answered: How do I know whether a scroller need to scroll?

    I mean how do I know if a panel's size is big enough so that every item in it is visible and does not need to scroll?

    I have a panel with vbox and buttons in it, I need to do a animated scroll if some items is not visible, but I don't need that animation if every item is visible, I currently use

    Code:
    scroller.scrollBy(0, 10, true);
    But even when panel is big enough it still scrolls a bit and scroll back, I need param 3 to be true as I need animation.

  2. You can check the size of the scroller element:

    Code:
    var cntHeight    = container.element.getHeight(),
        scrollable   = container.getScrollable(),
        scroller     = scrollable.getScroller(),
        scrollHeight = scroller.getElement().getHeight();
    
    console.log(cntHeight, scrollHeight);

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3932
    Vote Rating
    1272
      0  

    Default

    You can check the size of the scroller element:

    Code:
    var cntHeight    = container.element.getHeight(),
        scrollable   = container.getScrollable(),
        scroller     = scrollable.getScroller(),
        scrollHeight = scroller.getElement().getHeight();
    
    console.log(cntHeight, scrollHeight);
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •