2016-07-29 3 views
0

오브젝트를 Panel 항목으로 삽입해야합니다. 개체를 만들었고 Panel I에서는 항목을 배열로 배치합니다. 그런 다음 해당 객체를 배열 항목에 추가하는 방법.오브젝트를 패널 항목으로 삽입하는 방법

내 코드 :

{ 
    title : "Records", 
    bodyStyle: 'background: #dfe8f6;border:#dfe8f6;', 
    autoScroll: true, 
    id:'ExcludeRecord', 
    region: 'center', 
    layout:{ 
     type: 'vbox', 
     pack: 'start', 
     align: 'stretch' 
    }, 
    items: [], 
    }` 

답변

0

당신은 항목 배열에 객체를 넣을 수 있습니다

{ 
    title : "Records", 
    bodyStyle: 'background: #dfe8f6;border:#dfe8f6;', 
    autoScroll: true, 
    id:'ExcludeRecord', 
    region: 'center', 
    layout:{ 
     type: 'vbox', 
     pack: 'start', 
     align: 'stretch' 
    }, 
    items: [{ 
      xtype:'panel', 
      html:'Your Object' 
      }], 
    } 
2

당신은 패널에 항목을 추가하려면 아래의 코드를 사용할 수 있습니다

var panel = Ext.getCmp('ExcludeRecord'); 
panel.add(object); // Your object. 
panel.doLayout(); 

I 그것이 당신을 위해 일할 수 있기를 바랍니다.

+0

'beforerender' 또는'afterrender' 함수 나'initComponent' 함수에 써야합니다. – David

+0

네, 그 중 어떤 함수에서라도 쓸 수 있지만 그 함수에이 객체가 있어야합니다. Ext.apply (me, { items : [{object}], }); me.callParent (arguments); initComponent에서 위의 코드를 사용하여 해당 객체를 항목으로 직접 사용할 수 있습니다. –

+0

여러 레코드에 대해'for' 루프를 사용하고 있습니다. 그런 다음'panel.doLayout()'은 루프 내부에서 사용하기로되어 있습니다. 이 경우 한 번만 개체가 나타납니다. – David

관련 문제