1

ExtJS 3.4mainDetailsFieldSetを使用しています。2 つの形式で使用したいフィールドセットがaddFormPanelありupdateFormPanelます。フォームでフィールドセットをaddFormPanel取得できますが、updateFormPanel で取得できません。単一の青い線が表示されます。ここで何が問題なのかを見つけることができません...誰かが私を助けてくれますか?

これが私のコードです:

//テキストフィールドとコンボボックスを含むメインフィールドセット

  var clCombo = new Ext.form.ComboBox({
                    store: store,
                    fieldLabel: 'Name',
                    displayField: 'clName',
                    name: 'clName',
                    valueField: 'clName',
                    typeAhead: true,
                    mode: 'local',
                    triggerAction: 'all',
                    emptyText: 'Select Here'
          });
this.mainDetailsFieldSet = new Ext.form.FieldSet({
        title: 'Details',
        items:[
            {
                fieldLabel: ' Name',
                xtype: 'textfield',
                name: 'name'
                },clCombo
            ]
        });
var mainDetailsFieldSet = this.mainDetailsFieldSet ;

//addFormPanel、ここで mainfieldset を使用しています

this.addFormPanel = new Ext.form.FormPanel({
                title: 'Add Form',
                autoScroll: true,
                items:[
                    mainDetailsFieldSet ]
});

//updateformpanel、同じフィールド セットを再度追加する場所

this.updateFormPanel = new Ext.form.FormPanel({
            autoScroll: true,
            items:[mainDetailsFieldSet]
        }); 

前もって感謝します

4

2 に答える 2

2

1 つのインスタンスを別の場所にレンダリングすることはできません。

バリアント A: 2 回必要な場合は、2 つ目のインスタンスを作成する必要があります。

this.comboCfg = {
      store: store,
      fieldLabel: 'Name',
      displayField: 'clName',
      name: 'clName',
      valueField: 'clName',
      typeAhead: true,
      mode: 'local',
      triggerAction: 'all',
      emptyText: 'Select Here'
};
this.mainDetailsFieldSet1 = new Ext.form.FieldSet({
    title: 'Details',
    items:[{
        fieldLabel: ' Name',
        xtype: 'textfield',
        name: 'name'
        },Ext.apply({xtype:'combo'},comboCfg)]
});
this.mainDetailsFieldSet2 = new Ext.form.FieldSet({
    title: 'Details',
    items:[{
        fieldLabel: ' Name',
        xtype: 'textfield',
        name: 'name'
        },Ext.apply({xtype:'combo'},comboCfg)]
});
var mainDetailsFieldSet1 = this.mainDetailsFieldSet1;
var mainDetailsFieldSet2 = this.mainDetailsFieldSet2;

this.addFormPanel = new Ext.form.FormPanel({
     title: 'Add Form',
     autoScroll: true,
     items:[mainDetailsFieldSet1]
});

this.updateFormPanel = new Ext.form.FormPanel({
    autoScroll: true,
    items:[mainDetailsFieldSet2]
}); 

バリアント B:ただし、できることは、毎回インスタンスを削除して追加することです。

this.addFormPanel = new Ext.form.FormPanel({
     title: 'Add Form',
     autoScroll: true
});
// before show
this.addFormPanel.add(mainDetailsFieldSet);
// before hide
this.addFormPanel.remove(mainDetailsFieldSet);

this.updateFormPanel = new Ext.form.FormPanel({
     autoScroll: true
});
// before show
this.updateFormPanel .add(mainDetailsFieldSet);
// before hide
this.updateFormPanel .remove(mainDetailsFieldSet);

厳密に必要でない場合は、できるだけ頻繁に 's を使用して構成を使用し、独自にxtype定義しないでください。id


バリアント C:

this.comboCfg = {
      store: store,
      fieldLabel: 'Name',
      displayField: 'clName',
      name: 'clName',
      valueField: 'clName',
      typeAhead: true,
      mode: 'local',
      triggerAction: 'all',
      emptyText: 'Select Here'
};
this.mainDetailsFieldSetCfg = {
    xtype: 'fieldset',
    title: 'Details',
    items:[
       { xtype:'textfield',fieldLabel:' Name',name:'name'},
       Ext.apply({xtype:'combo'},comboCfg)
    ]
});

this.addFormPanel = new Ext.form.FormPanel({
     title: 'Add Form',
     autoScroll: true,
     items:[this.mainDetailsFieldSetCfg]
});

this.updateFormPanel = new Ext.form.FormPanel({
    autoScroll: true,
    items:[this.mainDetailsFieldSetCfg]
});
于 2014-12-10T11:06:04.893 に答える
0

同じ要素を 2 つの場所に追加すると、最初のフォームでのみレンダリングされ、他のフォームではレンダリングされないと確信しています。エラーとして扱います。2 番目のフォームの要素には別の ID を指定する必要があります。両方のフィールドセットは、異なる ID で区別される別個のエンティティである必要があります。ID が異なる限り、同じ構成を持つことができます。

于 2014-12-09T16:06:54.923 に答える