X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/0494b8d9b9bb03ab6c22b34dae81261e3cd7e3e6..7a654f8d43fdb43d78b63d90528bed6e86b608cc:/examples/app/nested-loading/app/view/book/View.js diff --git a/examples/app/nested-loading/app/view/book/View.js b/examples/app/nested-loading/app/view/book/View.js new file mode 100644 index 00000000..46f856d1 --- /dev/null +++ b/examples/app/nested-loading/app/view/book/View.js @@ -0,0 +1,66 @@ +/** + * The view which displays information about a speficied book + * @extends Ext.panel.Panel + */ +Ext.define('Books.view.book.View', { + alias: 'widget.bookview', + extend: 'Ext.panel.Panel', + + initComponent: function() { + Ext.apply(this, { + id : 'itemCt', + cls : 'item-ct', + flex : 2, + border : false, + autoScroll: true, + + layout: { + type : 'hbox', + align: 'middle', + pack : 'center' + }, + + items: [ + { + id : 'imgCt', + border: false, + margin: '0 10 0 0', + width : 250, + height: 308 + }, + { + id : 'contentCt', + width : 500, + border: false + } + ] + }); + + this.callParent(arguments); + }, + + /** + * Binds a record to this view + */ + bind: function(record) { + var imgCt = Ext.getCmp('imgCt'), + contentCt = Ext.getCmp('contentCt'); + + var imgTpl = new Ext.XTemplate( + '' + ); + + var contentTpl = new Ext.XTemplate( + '
{name} ${price}
', + '
By {author}
', + '
{detail}
' + ); + + imgTpl.overwrite(imgCt.el, record.data); + contentTpl.overwrite(contentCt.el, record.data); + + //update the layout of the contentTpl + contentCt.setHeight('auto'); + this.doLayout(); + } +}); \ No newline at end of file