]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | /**\r |
2 | * The view which displays information about a speficied book\r | |
3 | * @extends Ext.panel.Panel\r | |
4 | */\r | |
5 | Ext.define('Books.view.book.View', {\r | |
6 | alias: 'widget.bookview',\r | |
7 | extend: 'Ext.panel.Panel',\r | |
8 | \r | |
9 | requires: ['Ext.Img'],\r | |
10 | \r | |
11 | cls: 'item-ct',\r | |
12 | flex: 2,\r | |
13 | border: false,\r | |
14 | scrollable: true,\r | |
15 | \r | |
16 | initComponent: function() {\r | |
17 | Ext.apply(this, {\r | |
18 | layout: {\r | |
19 | type : 'hbox',\r | |
20 | align: 'middle',\r | |
21 | pack : 'center'\r | |
22 | },\r | |
23 | \r | |
24 | items: [{\r | |
25 | xtype: 'image',\r | |
26 | itemId: 'imgCt',\r | |
27 | src: Ext.BLANK_IMAGE_URL,\r | |
28 | margin: '0 20 0 0',\r | |
29 | width : 250,\r | |
30 | height: 308\r | |
31 | }, {\r | |
32 | xtype: 'component',\r | |
33 | tpl: [\r | |
34 | '<div class="name">{name} <span>${price}</span></div>',\r | |
35 | '<div class="author">By {author}</div>',\r | |
36 | '<div class="detail">{detail}</div>'\r | |
37 | ],\r | |
38 | itemId: 'contentCt',\r | |
39 | width: 500,\r | |
40 | border: false\r | |
41 | }]\r | |
42 | });\r | |
43 | \r | |
44 | this.callParent(arguments);\r | |
45 | },\r | |
46 | \r | |
47 | /**\r | |
48 | * Binds a record to this view\r | |
49 | */\r | |
50 | bind: function(record) {\r | |
51 | this.child('#imgCt').setSrc(record.get('image'));\r | |
52 | this.child('#contentCt').update(record.getData());\r | |
53 | }\r | |
54 | }); |