I have a generic class that extends Ext.dataview.List, and it is currently listing out a set of blogs that I have:
Ext.define('Blog.view.BlogList',{
extend: 'Ext.dataview.List',
xtype: 'blogList',
config: {
cls: 'blogList',
emptyText: 'No blogs found...',
itemCls: 'blogListItem',
itemTpl: [
'<div class="blogThumb"><img src="{image.medium}" /></div>',
'<div class="blogTitle">{title}</div>',
].join(''),
loadingText: 'Loading blogs...'
}
});
When someone taps on one of the items in the list, my controller currently runs the method, showBlog
. Here is my current controller:
Ext.define('Blog.controller.Main',{
extend: 'Ext.app.Controller',
config: {
refs: {
blogContainer: 'blogContainer',
blogList: 'blogList'
},
control: {
blogList: {
itemtap: 'showBlog'
}
}
},
slideLeftTransition: { type: 'slide', direction: 'left'},
init: function() {
console.log('Blog.controller.Main init');
},
launch: function() {
console.log('Blog.controller.Main launch');
},
showBlog: function(list, index, element, record) {
console.log('showing blog #'+record.data.id);
var blogContainer = this.getBlogContainer();
blogContainer.setData(record.data);
Ext.Viewport.animateActiveItem(blogContainer, this.slideLeftTransition);
}
});
So far, everything works really well, however, I can't figure out how to update all the components in my blogContainer with the new information from the tapped record?
I can't use the simple concept of creating a panel, because when a blog is tapped, I would like a fairly complex new container to appear...with sub components, etc.
How do I tell this new container which blog
to show the details of, and then update its info?