如何在ExtJS中滚动到表单的末尾 [英] How to scroll to the end of the form in ExtJS

查看:107
本文介绍了如何在ExtJS中滚动到表单的末尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有autoScroll功能的表单.向其中添加新项目时,如何滚动到表单底部?

I have a form with autoScroll feature. How can I scroll to the bottom of the form when I add a new item to it?

 height: 200,
 autoScroll: true,

这是我的示例代码

推荐答案

如果将字段添加到表单的末尾,则以下解决方案可能会有所帮助:

If the field is added at the end of the form then the following solution might help:

EXTJS 5& 6

EXTJS 5 & 6

http://docs .sencha.com/extjs/5.1.0/api/Ext.form.Panel.html#cfg-scrollable

以config形式:

scrollable: true,

在按钮处理程序中:

{
                xtype: 'button',
                itemId: 'addChildBtn',
                disabled: false,
                text: 'Clone fieldset',
                 handler: function () {
                // Clone field set 
                  var set = Ext.getCmp('s1');         
                 var s = set.cloneConfig();
                form.add(s);
                this.up('form').getScrollable().scrollTo(0, 9999);
                }
            }

EXTJS 4

http://docs.sencha.com/extjs/4.1.3/#!/api/Ext.form.Panel-method-scrollBy

在按钮处理程序中:

{
                xtype: 'button',
                itemId: 'addChildBtn',
                disabled: false,
                text: 'Clone fieldset',
                 handler: function () {
                // Clone field set 
                  var set = Ext.getCmp('s1');         
                 var s = set.cloneConfig();
                form.add(s);
                this.up('form').scrollBy(0, 9999, true);
                }
            }

这篇关于如何在ExtJS中滚动到表单的末尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆