PDA

View Full Version : load panel from new file in Item:



myput
12 Oct 2011, 4:45 AM
Hey,

I would like to know how to load a new Panel (who is in an another file) in a panel.

I have a problem with a nestedlist and in getDetailCard, i would like to load a List view who is in an another file.
In my NestedList:


getDetailCard: function(item, parent) {
var itemData = item.attributes.record.data;
parentData = parent.attributes.record.data;
this.backButton.setText(itemData.text);
var DetailPanel = new Ext.Panel({
recordNode: item,
items: [WPApp.views.DirectoryItemListContainer],
listeners: { beforeDestroy: function() { return false; } }
});
DetailPanel.update(itemData);
Ext.getStore(WPApp.stores.DirectoryItemListListStore).setId(itemData.idCategorie);
return DetailPanel;
}


And in my list file:


WPApp.views.DirectoryItemListContainer = new Ext.extend(Ext.List,{
fullscreen: true,
itemTpl: 'athing',
store: WPApp.stores.DirectoryItemListListStore,
});


I tried in the nestedList:


listeners: {
render: function() {
WPApp.views.DirectoryPanel.setActiveItem(WPApp.views.DirectoryItemListContainer );
}
}


cause the list is loading in Directory Panel:


initComponent: function() {
Ext.apply(WPApp.views, {
DirectoryNestedListPanel: new WPApp.views.DirectoryNestedListPanel(),
DirectoryDetailPanel: new WPApp.views.DirectoryDetailPanel(),
DirectoryListItemPanel: new WPApp.views.DirectoryListItemPanel()
});
this.items = [
WPApp.views.DirectoryNestedListPanel,
WPApp.views.DirectoryDetailPanel,
WPApp.views.DirectoryListItemPanel
];
WPApp.views.DirectoryPanel.superclass.initComponent.call(this);
this.doComponentLayout();
}


The problem is when i load my List, i would like to can go back in my last item of nestedList.

Have you an idea?

myput
17 Oct 2011, 7:52 AM
I find a temporary solution, but i have some bugs:
in my nestedList DetailCard:


getDetailCard: function(item, parent) {
var itemData = item.attributes.record.data;
parentData = parent.attributes.record.data;
var DetailPanel = new Ext.Panel({
recordNode: item,
items: [WPApp.views.DirectoryItemListContainer],
listeners: { beforeDestroy: function() { return false; } }
});
DetailPanel.update(itemData);
Ext.getStore(WPApp.stores.DirectoryItemListListStore).setId(itemData.idCategorie);
return DetailPanel;
},


The WPApp.views.DirectoryItemListContainer:


WPApp.views.DirectoryItemListContainer = new Ext.Panel ({
id: 'WPApp.views.DirectoryItemListContainer',
fullscreen: true,
layout: 'card',
items: [{ xtype: 'DirectoryListLoad' }],
});

And directory List Load:


WPApp.views.DirectoryListLoad = Ext.extend(Ext.Panel, {
initComponent: function(){
Ext.apply(WPApp.views, {
DirectoryListItemPanel: new WPApp.views.DirectoryListItemPanel(),
});
this.items = [
WPApp.views.DirectoryListItemPanel,
];
WPApp.views.DirectoryListLoad.superclass.initComponent.call(this);
this.doComponentLayout();
}
});


Ext.reg('DirectoryListLoad', WPApp.views.DirectoryListLoad);


For the list, it's good; i can display the list after the last item of the nestedList.

But i have a big problem: i don't know how to do for display the detail panel of the simple list ...
I tried in DirectoryListLoad, but it makes some bugs .... i can't come back to the list ...

Someone have an idea please?

myput
19 Oct 2011, 7:51 AM
Xtype don't really work, is there an another solution ?