Как я могу отобразить одну и ту же панель несколько раз? - PullRequest
2 голосов
/ 13 сентября 2011

Полагаю, мой вопрос настолько простой, но мне все равно нужна помощь ... дело в том, что у меня есть карусель с 5 картами (которые являются панелями), и внутри этой панели я хочу вызвать другие панели, которые будут такими же все 5 карточек ..

Чтобы проиллюстрировать, что я имею в виду, вот несколько примеров кода:

//Here I'm creating the panel

this.testeCard(); 

MYPROJ.UI.prototype.testeCard = function(){
var teste = new Ext.Panel({
    html: 'teste teste teste',
    style: 'background-color: #2f7da8'
});
this._registerView(teste,'teste');
return teste;
};

//Here I'm calling it

MYPROJ.UI.prototype.currentCard = function(){
var currentCard = new Ext.Panel({
    id: 'currentCard',
    cls: 'mainPanel',
    //html: 'currentCard',
    items:[
        this.getView('teste')   //Fine here
    ]
});        
this._registerView(currentCard, 'currentCard');
return currentCard;    
};

MYPROJ.UI.prototype.anotherCard = function(){
var currentCard = new Ext.Panel({
    id: 'currentCard',
    cls: 'mainPanel',
    //html: 'currentCard',
    items:[
        this.getView('teste')   
    ]
});        
this._registerView(currentCard, 'currentCard');
return currentCard;    
};

Итак, я хочу назвать эту карту «teste» как в «currentCard», так и в anotherCard.

Как мне это сделать ????

1 Ответ

0 голосов
/ 13 апреля 2012

Может быть, это может помочь вам ..

teste.show();
teste.setActiveItem(currentCard, 'slide');

teste.show();
teste.setActiveItem(anotherCard, 'slide');
...