weixin_42305322 2009-07-18 07:54
浏览 534
已采纳

如何维护ExtJs FormPanel中滚动条的位置

将FormPanel设置autoScroll:true后,如何得到滚动条的位置,并设置其滚动位置
[b]问题补充:[/b]
无法实现,页面明明有滚动条可用isScrollable判读为false,alert(getScroll对象)是{left:0,top:0} 而且scroll和scrollTo方法也不会有反映,你验证过吗?能给个实际的方法,别Ctrl+C Element API行吗?

  • 写回答

2条回答 默认 最新

  • zhoujuan520 2009-07-18 09:42
    关注

    FormPanel.el.getScroll();//得到滚动条对象

    //对象内容 {left:(scrollLeft),top:(scrollTop)}
    an object containing the scroll position in the format {left: (scrollLeft), top: (scrollTop)}

    FormPanel.el.isScrollable();//判断对象是否可以滚动

    scroll(方向,滚动多少,是否动画);
    scroll( String direction, Number distance, [Boolean/Object animate] ) : Boolean

    Scrolls this element the specified direction. Does bounds checking to make sure the scroll is within this element's scrollable range.
    Parameters:

    * direction : String 方向参数 l:左边滚动 ,r:右边滚动, t:上边滚动, b:下滚动
      Possible values are: "l" (or "left"), "r" (or "right"), "t" (or "top", or "up"), "b" (or "bottom", or "down").
    * distance : Number
      How far to scroll the element in pixels
    * animate : Boolean/Object
      (optional) true for the default animation or a standard Element animation config object
    

    Returns:

    * Boolean
      Returns true if a scroll was triggered or false if the element was scrolled as far as it could go.
    

    scrollIntoView( [Mixed container], [Boolean hscroll] ) : Ext.Element

    scrollTo(往哪滚动,滚动多少,动画否);
    scrollTo( String side, Number value, [Boolean/Object animate] ) : Element

    Scrolls this element the specified scroll point. It does NOT do bounds checking so if you scroll to a weird value it will try to do it. For auto bounds checking, use scroll().
    Parameters:

    * side : String
      Either "left" for scrollLeft values or "top" for scrollTop values.
    * value : Number
      The new scroll value
    * animate : Boolean/Object
      (optional) true for the default animation or a standard Element animation config object
    

    Returns:

    * Element
      this
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 根据以下文字信息,做EA模型图
  • ¥15 删除虚拟显示器驱动 删除所有 Xorg 配置文件 删除显示器缓存文件 重启系统 可是依旧无法退出虚拟显示器
  • ¥15 vscode程序一直报同样的错,如何解决?
  • ¥15 关于使用unity中遇到的问题
  • ¥15 开放世界如何写线性关卡的用例(类似原神)
  • ¥15 关于并联谐振电磁感应加热
  • ¥60 请查询全国几个煤炭大省近十年的煤炭铁路及公路的货物周转量
  • ¥15 请帮我看看我这道c语言题到底漏了哪种情况吧!
  • ¥60 关机时蓝屏并显示KMODE_EXCEPTION_NOT_HANDLED,怎么修?
  • ¥66 如何制作支付宝扫码跳转到发红包界面