2011-11-24 3 views
1

새 클래스 "ConfirmationPanel"을 정의했으며 창 내부에서이 패널을 만들고 싶습니다. 처음 창을 만들 때 잘 나옵니다. 그러나 두 번째 창을 만들면 창 -1의 패널이 창 -2로 이동합니다. 각 창마다 동일한 패널을 두 번 만들고 싶습니다. 어떻게해야합니까? Ext JS - 동일한 격자를 여러 번 생성하는 것이 작동하지 않습니다.

Ext.define('MyApp.views.ConfirmationPanel', { 
    extend: 'Ext.grid.Panel', 
    requires: 'MyApp.store.ConfirmationStore', 
    border: false, 
    initComponent: function() { 
     this.store = Ext.create('MyApp.store.ConfirmationStore', {}); 
     this.columns = this.buildColumns(); 
     this.callParent(arguments); 
    }, 
    buildColumns: function() { 
     return [ 
      {text: "Id", width: 50, flex: 1, dataIndex: 'docId', sortable: true}, 
      {text: "Name", width: 150, dataIndex: 'docName', sortable: true}, 
      {text: "Type", width: 75, dataIndex: 'docType', sortable: true}, 
      {text: "URL", width: 115, dataIndex: 'docUrl', sortable: true}, 
      {text: "Sent Time", width: 115, dataIndex: 'docSentTime', sortable: true}, 
      {text: "Ack Time", width: 115, dataIndex: 'docAckTime', sortable: true} 
     ]; 
    }, 
    viewConfig: { 
     listeners: { 
      itemdblclick: function(dataview, record, item, index, e) { 
       alert('opening document here'); 
      } 
     } 
    } 
}); 

어떤 도움/조언

에 감사드립니다.

---- 아래 tabpanel 내부에 패널의 새 인스턴스를 만들려고했습니다. 그러나 그 후에도 단 하나의 인스턴스 만 만들었습니다. 나는 기본적으로 잘못된 것을하고있을 수 있습니다.

items: { 
     xtype:'tabpanel', 
     plain:true, 
     activeTab: 0, 
     height:350, 
     defaults:{ 
      bodyPadding: 10 
     }, 
     items: [ 
      { 
       title:'Test', 
       items: Ext.create('Ext.panel.Panel', { 
        bodyPadding: 5, 
        title: 'Filters', 
        items: [{ 
         xtype: 'datefield', 
         fieldLabel: 'Start date' 
        }, { 
         xtype: 'datefield', 
         fieldLabel: 'End date' 
        }] 
       }) 

      }, 
      { 
       title:'My Confirms', 
       items: Ext.create("MyApp.views.ConfirmationPanel") 
      } 
     ] 
    } 
+0

두 번째로 만드는 방법을 보여줄 수 있습니까? ConfirmationPanel의 입장? –

+0

더 많은 코드를 공유 할 수 있습니까? 특히 새 창을 만드는 곳. 두 구성 요소가 같은 ID를 얻는 경우가 종종 있습니다. –

답변

0

Ext.define('MyApp.views.ConfirmationPanel', { 
    ... 
    alias: 'confirmpanel', 
    ... 

및 탭 패널 내부에 시도 :

 { 
      title:'My Confirms', 
      items: [{ 
       xtype: 'confirmpanel' 
      }] 
     } 

당신이 MyApp.views.ConfirmationPanel의 하나의 인스턴스 만이 중에 생성되기 때문에 얻을 이러한 행동의 이유 Ext.create ("MyApp.views.ConfirmationPanel")를 통한 설정

관련 문제