简体   繁体   English

我如何在extjs中加载嵌套表单

[英]How can i load nested forms in extjs

I have the simple form with textfields and its working fine. 我有一个简单的文本字段形式,并且工作正常。

Now i have the requirement that user should be able add many tags in the form. 现在,我要求用户应该能够在表单中添加许多标签。

The form is hardcoded with fields. 表单使用字段进行硬编码。

then i need section called tags where by default i will have single textbox and add button so that user can add more tags by typing. 然后我需要一个称为标签的部分,默认情况下,我将具有单个文本框和添加按钮,以便用户可以通过键入添加更多标签。

I am thinking of using tags in separate forms but i am not sure how to do it 我正在考虑以单独的形式使用标签,但是我不确定该怎么做

Any ideas please 有什么想法吗

Here is a simple JSFidle in ExtJS 4.2.0 with dynamic adding of fields to formpanel and sending them on form submit to backend. 是ExtJS 4.2.0中的一个简单JSFidle,具有将字段动态添加到formpanel并将它们通过表单提交发送到后端的功能。

You can see that newly added fields getting sent to backend in fiddler. 您可以看到新添加的字段在fiddler中发送到了后端。

And below is the code I have added to dynamically add fields on Add Tags Button Click : 下面是我添加的代码,用于在“ 添加标签”按钮上动态添加字段单击:

   {
        xtype:'button',
        text:'Add Tags',
        width:100,
        handler:function(btn){
            formpanel.add({
                fieldLabel: 'New Item'+formpanel.items.length,     // formpanel is the name of the formpanel
                name: 'item'+formpanel.items.length,
                allowBlank: false
            });           
        }
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM