gpt4 book ai didi

javascript - 在表单中添加值 Sencha Touch 2

转载 作者:行者123 更新时间:2023-11-28 20:39:22 25 4
gpt4 key购买 nike

我有几个 FormPanel。您可以在每个字段中输入值。我需要一些东西来添加所有这些值。我可以用循环或函数来完成吗?这是我的代码:

view1.js:

Ext.define('myApp.view.fp2', {
extend: 'Ext.form.Panel',
alias: 'widget.fp2',

config: {
id: 'fp2',
styleHtmlContent: true,
items: [
{
xtype: 'fieldset',
styleHtmlContent: true,
title: 'Prueba 3',
items: [
{
xtype: 'selectfield',
docked: 'bottom',
id: 'f3',
margin: 10,
labelWidth: '0%',
autoSelect: false,
options: [
{
text: '0',
value: 0
},
{
text: '1',
value: 1
}
]
}
]
},
{
xtype: 'fieldset',
styleHtmlContent: true,
title: 'Prueba 4',
items: [
{
xtype: 'selectfield',
docked: 'bottom',
id: 'f4',
margin: 10,
labelWidth: '0%',
autoSelect: false,
options: [
{
text: '0',
value: 0
},
{
text: '1',
value: 1
},
{
text: '2',
value: 2
}
]
}
]
},
{
xtype: 'fieldset',
styleHtmlContent: true,
title: 'Prueba 5',
items: [
{
xtype: 'selectfield',
docked: 'bottom',
id: 'f5',
margin: 10,
labelWidth: '0%',
autoSelect: false,
options: [
{
text: '0',
value: 0
},
{
text: '1',
value: 1
},
{
text: '2',
value: 2
},
{
text: '3',
value: 3
}
]
}
]
},
{
xtype: 'fieldset',
html: 'pregunta 6',
styleHtmlContent: true,
title: 'Prueba 6',
items: [
{
xtype: 'selectfield',
docked: 'bottom',
id: 'f6',
margin: 10,
labelWidth: '0%',
autoSelect: false,
options: [
{
text: '0',
value: 0
},
{
text: '1',
value: 1
}
]
}
]
}
{
xtype: 'button',
docked: 'bottom',
itemId: 'button2',
margin: 10,
ui: 'forward',
text: 'siguiente'
//go to view2.js
}
]
}
});

view2.js 与 view1 类似,但具有其他值。总结所有值的最佳方法是什么?

提前致谢。

最佳答案

总结一下?我认为您想将它们全部作为键值获取?

对于每个 Ext.form.FormPanel 调用

var valueObj = formRef.getForm().getValues();

如果您现在想将它们合并为一个对象,您可以这样做

Ext.apply(sumValueObj, valueObj ); // will override already existing props

Ext.applyIf(sumValueObj, valueObj ); // will not override already existing props

关于javascript - 在表单中添加值 Sencha Touch 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14704991/

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