2013-07-25 2 views
0

그래서 나는 Ext.panel.PanelExt JS에서 패널의 속성을 동적으로 변경할 수 있습니까?

Ext.define('SomeView', { 
    extend: 'Ext.panel.Panel', 
    alias: 'someview', 
    title: 'Some View', 
    closable: true, 
    initComponent: function() { 
     this.itemId = 'someView'; 
     this.callParent(arguments); 
    }, 

    layout: { 
     type: 'vbox', 
     align: 'stretch' 
    }, 

    items: [ 
     { 
      xtype: 'container', 
      layout: 'hbox', 
      items: [ 
       { 
        xtype: 'container', 
        itemId: 'someContainer', 
        tpl: '<h2>{someProperty}</h2>', 
        flex: 1 
       }, 
    // other code omitted for brevity 
}); 

이 같은 뷰를 초기화를 확장하는 다음보기가 있습니다. 뷰 I뿐만 아니라 도시 someProperty 전달할 파라미터를 나타낸 후

var panel = Ext.create('someview', { 
    someProperty: 'Some Value' 
}); 

. 그러나 문제는보기가 표시된 후 someProperty을 변경하려고합니다. 내가 할 수 있을까? 그렇다면 어떻게? 나는 이것을 이렇게 바꿀 수 있다는 것을 의미한다.

panel.someProperty = 'Some New Value'; 

그러나보기는 그 자체로 영향을 미치지 않는다.

당신은 화면에 표시되는 내용 업데이트의 실제 작업을 수행하기 위해 패널 클래스에 멤버 함수를 추가 할 것입니다

답변

1

:

setSomeProperty: function(prop) { 
    this.down('#someContainer').update({someProperty: prop}); 
} 
관련 문제