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

如何维护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条)

报告相同问题?

悬赏问题

  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥15 state显示变量是字符串形式,但是仍然红色,无法引用,并显示类型不匹配
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波