1 Ext.Loader.setConfig({enabled: true});
3 Ext.Loader.setPath('Ext.ux', '../ux/');
8 'Ext.grid.PagingScroller'
11 Ext.onReady(function(){
12 Ext.define('ForumThread', {
13 extend: 'Ext.data.Model',
15 'title', 'forumtitle', 'forumid', 'author',
16 {name: 'replycount', type: 'int'},
17 {name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp'},
18 'lastposter', 'excerpt', 'threadid'
20 idProperty: 'threadid'
23 // create the Data Store
24 var store = Ext.create('Ext.data.Store', {
29 // allow the grid to interact with the paging scroller by buffering
32 // load using script tags for cross domain, if the data in on the same domain as
33 // this page, an HttpProxy would be better
35 url: 'http://www.sencha.com/forum/remote_topics/index.php',
41 totalProperty: 'totalCount'
43 // sends single sort as multi parameter
52 function renderTopic(value, p, record) {
53 return Ext.String.format(
54 '<a href="http://sencha.com/forum/showthread.php?t={2}" target="_blank">{0}</a>',
56 record.data.forumtitle,
63 var grid = Ext.create('Ext.grid.Panel', {
66 title: 'ExtJS.com - Browse Forums',
68 verticalScrollerType: 'paginggridscroller',
70 disableSelection: true,
71 invalidateScrollerOnRefresh: false,
76 columns:[{xtype: 'rownumberer',width: 50, sortable: false},{
77 // id assigned so we can apply custom css (e.g. .x-grid-cell-topic b { color:#333 })
78 // TODO: This poses an issue in subclasses of Grid now because Headers are now Components
79 // therefore the id will be registered in the ComponentManager and conflict. Need a way to
80 // add additional CSS classes to the rendered cells.
85 renderer: renderTopic,
95 dataIndex: 'replycount',
102 dataIndex: 'lastpost',
104 renderer: Ext.util.Format.dateRenderer('n/j/Y g:i A'),
107 renderTo: Ext.getBody()
110 // trigger the data store load
111 store.guaranteeRange(0, 199);