13693261870
2022-09-16 354b3dbfbffb3df45212a2a44dbbf48b4acc2594
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
 * 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',
    
    requires: ['Ext.Img'],
    
    initComponent: function() {
        Ext.apply(this, {
            cls: 'item-ct',
            flex: 2,
            border: false,
            autoScroll: true,
            layout: {
                type : 'hbox',
                align: 'middle',
                pack : 'center',
                availableSpaceOffset: Ext.getScrollbarSize().width
            },
            
            items: [{
                xtype: 'image',
                itemId: 'imgCt',
                src: Ext.BLANK_IMAGE_URL,
                margin: '0 20 0 0',
                width : 250,
                height: 308
            }, {
                xtype: 'component',
                tpl: [
                    '<div class="name">{name} <span>${price}</span></div>',
                    '<div class="author">By {author}</div>',
                    '<div class="detail">{detail}</div>'
                ],
                itemId: 'contentCt',
                width: 500,
                border: false
            }]
        });
                
        this.callParent(arguments);
    },
    
    /**
     * Binds a record to this view
     */
    bind: function(record) {
        this.child('#imgCt').setSrc(record.get('image'));
        this.child('#contentCt').update(record.getData());
    }
});