PDA

View Full Version : List Component - using onItemTap instead of onItemDisclosure



evographics
28 Apr 2011, 5:00 AM
Hello,
I watched the tutorial about List Component on Sencha Vimeo Video Link (http://vimeo.com/19245335), but I don't like the onItemDisclosure solution for more info panel. Is there a way to get the same result using the onItemTap event instead of tapping on the arrow button?

Thanks,

Michele

realjax
28 Apr 2011, 6:53 AM
new Ext.List({
....
listeners:{
itemtap: function([arguments]){
//do whatever you like here with the [arguments]
}
}
})

can't remember the arguments, check the API docs. the first is the list itself probably and the second is the item tapped, but there are more.

evographics
28 Apr 2011, 7:45 AM
this is a part of my file:

ListDemo.listPanel = new Ext.List({
id: 'indexlist',
store: ListDemo.ListStore,
itemTpl: '<div class="contact">{firstName} {lastName}</div>',
grouped: true,
listeners:{
itemtap: function(view, index, item, e){
// *2 my result do not work , how can I get the "firstName" or any data using this event?
var name = view.data.firstName + " " + view.data.lastName;
ListDemo.detailToolbar.setTitle(name);
ListDemo.detailPanel.update(view.data);
ListDemo.Viewport.setActiveItem('detailpanel');
}
},

onItemDisclosure: function(record) {
//good result
var name = record.data.firstName + " " + record.data.lastName;
ListDemo.detailToolbar.setTitle(name);
ListDemo.detailPanel.update(record.data);
ListDemo.Viewport.setActiveItem('detailpanel');
}
});

how can I get the same result as *1 [comment] with my solution *2

realjax
28 Apr 2011, 8:34 AM
replace view.data.first-name with view.getStore().getAt(index).data.firstname

nb. this is from the top of my head and using my phone so there might be typos and getstore() might be a different function.

evographics
28 Apr 2011, 8:49 AM
Thank you so much :) It works.

antonccc
16 May 2011, 9:24 AM
Hello,

I tried your example and it work partially. In the details panel i get the word 'undefined ' instead of my template.

Any ideas why is this happening?

Thanks