Upgrade to ExtJS 4.0.1 - Released 05/18/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                 minHeight: 150
17             }, {
18                 split: true,
19                 height: 300,
20                 region: 'south',
21                 itemId: 'preview',
22                 title: 'View Topic',
23                 minHeight: 150,
24                 bodyPadding: 10,
25                 tpl: '<b><u>{title}</u></b><br /><br />Post details here.'
26             }]
27         });
28         this.callParent();
29     },
30
31     afterLayout: function() {
32         this.callParent();
33
34         // IE6 likes to make the content disappear, hack around it...
35         if (Ext.isIE6) {
36             this.el.repaint();
37         }
38     },
39     
40     loadForum: function(rec) {
41         this.tab.setText(rec.get('text'));
42         this.child('#grid').loadForum(rec.getId());
43     },
44     
45     onSelect: function(rec) {
46         this.child('#preview').update({
47             title: rec.get('title')
48         });
49     },
50     
51     togglePreview: function(show){
52         var preview = this.child('#preview');
53         if (show) {
54             preview.show();
55         } else {
56             preview.hide();
57         }
58     }
59 });