PDA

View Full Version : List, can't do setActiveItem oO



myput
24 Oct 2011, 4:42 AM
Hello, i have a problem with my list, i can't do a setActiveItem. I tried some method but nothing work...
but when i display the record on itemtap, all is good ...



WPApp.views.DirectoryDetailPanel = new Ext.Panel ({
//dockedItems: [WPApp.views.DirectoryItemListDetailToolbar],
id: "WPApp.views.DirectoryDetailPanel",
fullscreen: true,
html: 'detail'
});


WPApp.views.DirectoryListItemPanel = Ext.extend(Ext.List,{
fullscreen: true,
itemTpl: loadURL(WPApp.config.host + WPApp.config.DirectoryTPL + 'DirectoryItemListPanel.html'),
itemSelector: 'div.ItemListItem',
singleSelect: true,
store: WPApp.stores.DirectoryItemListListStore,
listeners: {
itemtap: function(view, index) {
var record = WPApp.views.DirectoryListItemPanel.getStore().getAt(index);
this.setActiveItem(WPApp.views.DirectoryDetailPanel, {animation: {type:'flip'}});
}
}
});


I don't understand ... have you an idea?
Thanks

mitchellsimoens
24 Oct 2011, 8:32 AM
Ext.List does not have a setActiveItem method. If you have a Panel or Container that uses things like Card layout then you can do setActiveItem on the Panel/Container.

myput
24 Oct 2011, 11:10 PM
Thanks for your answer.

Yes it's what i did now. But there is a problem. In my detailCard, i can't access to my items without problems. When i open the detailcard one time, it's okey ... But when i come back and click on the item or another, nothing in items of detailcard is displayed ....



WPApp.views.DirectoryDetailPanel = new Ext.Panel ({
dockedItems: [WPApp.views.DirectoryItemListDetailToolbar],
id: "WPApp.views.DirectoryDetailPanel",
fullscreen: true,
tpl: '{name}',
items: [
{
xtype: 'button',
ui: 'round',
margin: 15,
flex: 1,
text: 'desciption'
}
],
});


WPApp.views.DirectoryListItemPanel = new Ext.List ({
fullscreen: true,
itemTpl: loadURL(WPApp.config.host + WPApp.config.DirectoryTPL + 'DirectoryItemListPanel.html'),
itemSelector: 'div.ItemListItem',
singleSelect: true,
store: WPApp.stores.DirectoryItemListListStore,
listeners: {
itemtap: function(view, index) {
var record = WPApp.views.DirectoryListItemPanel.getStore().getAt(index);
WPApp.views.DirectoryDetailPanel.update(record.data);
WPApp.views.DirectoryItemListContainer.setActiveItem(WPApp.views.DirectoryDetailPanel, {animation: {type:'flip'}});
}
},
});


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

In this example, the button is displayed only one time ....
I don't understand.

Have you an idea?