1 Ext.Loader.setConfig({enabled: true});
3 Ext.Loader.setPath('Ext.ux', '../ux/');
9 'Ext.ux.PreviewPlugin',
11 'Ext.tip.QuickTipManager'
16 Ext.onReady(function(){
17 Ext.tip.QuickTipManager.init();
19 Ext.define('ForumThread', {
20 extend: 'Ext.data.Model',
22 'title', 'forumtitle', 'forumid', 'author',
23 {name: 'replycount', type: 'int'},
24 {name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp'},
25 'lastposter', 'excerpt', 'threadid'
27 idProperty: 'threadid'
30 // create the Data Store
31 var store = Ext.create('Ext.data.Store', {
36 // load using script tags for cross domain, if the data in on the same domain as
37 // this page, an HttpProxy would be better
39 url: 'http://www.sencha.com/forum/topics-browse-remote.php',
42 totalProperty: 'totalCount'
44 // sends single sort as multi parameter
54 function renderTopic(value, p, record) {
55 return Ext.String.format(
56 '<b><a href="http://sencha.com/forum/showthread.php?t={2}" target="_blank">{0}</a></b><a href="http://sencha.com/forum/forumdisplay.php?f={3}" target="_blank">{1} Forum</a>',
58 record.data.forumtitle,
64 function renderLast(value, p, r) {
65 return Ext.String.format('{0}<br/>by {1}', Ext.Date.dateFormat(value, 'M j, Y, g:i a'), r.data['lastposter']);
69 var pluginExpanded = true;
70 var grid = Ext.create('Ext.grid.Panel', {
73 title: 'ExtJS.com - Browse Forums',
75 disableSelection: true,
90 // id assigned so we can apply custom css (e.g. .x-grid-cell-topic b { color:#333 })
91 // TODO: This poses an issue in subclasses of Grid now because Headers are now Components
92 // therefore the id will be registered in the ComponentManager and conflict. Need a way to
93 // add additional CSS classes to the rendered cells.
98 renderer: renderTopic,
108 dataIndex: 'replycount',
115 dataIndex: 'lastpost',
117 renderer: renderLast,
120 // paging bar on the bottom
121 bbar: Ext.create('Ext.PagingToolbar', {
124 displayMsg: 'Displaying topics {0} - {1} of {2}',
125 emptyMsg: "No topics to display",
128 text: 'Show Preview',
129 pressed: pluginExpanded,
131 toggleHandler: function(btn, pressed) {
132 var preview = Ext.getCmp('gv').getPlugin('preview');
133 preview.toggleExpanded(pressed);
137 renderTo: 'topic-grid'
140 // trigger the data store load