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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Ext.define('KitchenSink.view.grid.LockingGrid', {
    extend: 'Ext.grid.Panel',
    requires: [
        'Ext.grid.RowNumberer'
    ],
    xtype: 'locking-grid',
    store: 'Companies',
    columnLines: true,
    height: 350,
    width: 600,
    title: 'Locking Grid Column',
    viewConfig: {
        stripeRows: true
    },
 
    //<example>
    exampleDescription: [
        '<p>This example shows how to achieve "freeze pane" locking functionality similar ',
        'to Excel.</p><p>Columns may be locked or unlocked by dragging them across into ',
        'the opposite side, or by using the column\'s header menu.</p><p>The "Price" column ',
        'is not lockable, and may not be dragged into the locked side, or locked using the ',
        'header menu.</p><p>It is not possible to lock <i>all</i> columns using the user ',
        'interface. The unlocked side must always contain at least one column.</p>',
        '<p>There is also an initially hidden "Tall Header" that shows wrapping header text.'
    ],
    themes: {
        classic: {
        },
        neptune: {
        }
    },
    //</example>
 
    initComponent: function () {
        this.columns = [{
                xtype: 'rownumberer'
            }, {
                text     : 'Company Name',
                locked   : true,
                width    : 230,
                sortable : false,
                dataIndex: 'company'
            }, {
                text     : 'Price',
                lockable: false,
                width    : 80,
                sortable : true,
                renderer : 'usMoney',
                dataIndex: 'price'
            }, {
                text     : 'Tall<br>Header',
                hidden   : true,
                width    : 70,
                sortable : false,
                renderer : function(val) {
                    return Math.round(val * 3.14 * 100) / 10;
                },
                dataIndex: 'change'
            }, {
                text     : 'Change',
                width    : 90,
                sortable : true,
                renderer : function(val) {
                    if (val > 0) {
                        return '<span style="color:green;">' + val + '</span>';
                    } else if (val < 0) {
                        return '<span style="color:red;">' + val + '</span>';
                    }
                    return val;
                },
                dataIndex: 'change'
            }, {
                text     : '% Change',
                width    : 105,
                sortable : true,
                renderer : function(val) {
                    if (val > 0) {
                        return '<span style="color:green;">' + val + '%</span>';
                    } else if (val < 0) {
                        return '<span style="color:red;">' + val + '%</span>';
                    }
                    return val;
                },
                dataIndex: 'pctChange'
            }, {
                text     : 'Last Updated',
                width    : 135,
                sortable : true,
                renderer : Ext.util.Format.dateRenderer('m/d/Y'),
                dataIndex: 'lastChange'
            }];
 
        this.callParent();
    }
});