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
96
97
98
99
100
101
102
103
Ext.require([
    'Ext.data.*',
    'Ext.grid.*',
    'Ext.tree.*'
]);
 
Ext.onReady(function() {
    Ext.QuickTips.init();
 
    Ext.define('Post', {
        extend: 'Ext.data.Model',
        idProperty: 'postid',
        fields: [{
            name: "title",
            convert: undefined
        }, {
            name: "threadid",
            convert: undefined
        }, {
            name: "username",
            convert: undefined
        }, {
            name: "userid",
            convert: undefined
        },  {
            name: "dateline",
            type: 'date',
            dateFormat: 'timestamp'
        }, {
            name: "postid",
            convert: undefined
        }, {
            name: "forumtitle",
            convert: undefined
        }, {
            name: "forumid",
            convert: undefined
        }, {
            name: "replycount",
            type: 'int',
            convert: undefined
        }, {
            name: "lastpost",
            dateFormat: 'timestamp',
            convert: undefined
        }, {
            name: "excerpt",
            convert: undefined
        }]
    });
 
    function renderTitle(value, p, record) {
        return value ? Ext.String.format(
            '<a href="http://sencha.com/forum/showthread.php?t={1}" target="_blank">{0}</a>',
            value,
            record.data.threadid
        ) : '';
    }
 
    var store = Ext.create('Ext.data.TreeStore', {
        model: 'Post',
        proxy: {
            type: 'ajax',
            reader: 'json',
            url: 'forum-data.json'
        },
        lazyFill: true
    });
 
    Ext.create('Ext.tree.Panel', {
        title: 'Forum Folder Summary',
        width: 600,
        height: 400,
        renderTo: Ext.getBody(),
        collapsible: true,
        loadMask: true,
        useArrows: true,
        rootVisible: false,
        store: store,
        animate: false,
        plugins: [{
            ptype: 'bufferedrenderer'
        }],
        columns: [{
            xtype: 'treecolumn', //this is so we know which column will show the tree
            text: 'Forum',
            width: 275,
            sortable: true,
            locked: true,
            dataIndex: 'forumtitle'
        },{
            text: 'User',
            width: 120,
            dataIndex: 'username',
            sortable: true
        }, {
            text: 'Title',
            width: 300,
            dataIndex: 'title',
            renderer: renderTitle
        }]
    });
});