gpt4 book ai didi

javascript - 如何在 ExtJS 中滚动到表单末尾

转载 作者:太空宇宙 更新时间:2023-11-04 16:20:44 25 4
gpt4 key购买 nike

我有一个具有自动滚动功能的表单。当我向表单添加新项目时,如何滚动到表单底部?

 height: 200,
autoScroll: true,

这是我的样本 code

最佳答案

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

EXTJS 5 和 6

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

在表单配置中:

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);
}
}

关于javascript - 如何在 ExtJS 中滚动到表单末尾,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40672250/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com