Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / examples / forum / classes / TopicContainer.js
1 Ext.define('ForumBrowser.TopicContainer', {
2     
3     extend: 'Ext.container.Container',
4     
5     alias: 'widget.topiccontainer',
6     
7     title: 'Loading...',
8     
9     initComponent: function(){
10         Ext.apply(this, {
11             layout: 'border',
12             items: [{
13                 itemId: 'grid',
14                 xtype: 'topicgrid',
15                 region: 'center'
16             }, {
17                 split: true,
18                 height: 300,
19                 region: 'south',
20                 itemId: 'preview',
21                 title: 'View Topic',
22                 bodyPadding: 10,
23                 tpl: '<b><u>{title}</u></b><br /><br />Post details here.'
24             }]
25         });
26         this.callParent();
27     },
28
29     afterLayout: function() {
30         this.callParent();
31
32         // IE6 likes to make the content disappear, hack around it...
33         if (Ext.isIE6) {
34             this.el.repaint();
35         }
36     },
37     
38     loadForum: function(rec) {
39         this.tab.setText(rec.get('text'));
40         this.child('#grid').loadForum(rec.getId());
41     },
42     
43     onSelect: function(rec) {
44         this.child('#preview').update({
45             title: rec.get('title')
46         });
47     },
48     
49     togglePreview: function(show){
50         var preview = this.child('#preview');
51         if (show) {
52             preview.show();
53         } else {
54             preview.hide();
55         }
56     }
57 });