3 This file is part of Ext JS 4
5 Copyright (c) 2011 Sencha Inc
7 Contact: http://www.sencha.com/contact
9 GNU General Public License Usage
10 This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file. Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.
12 If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.
15 Ext.Loader.setConfig({enabled: true});
17 Ext.Loader.setPath('Ext.ux', '../ux/');
22 'Ext.grid.PagingScroller'
25 Ext.onReady(function(){
26 Ext.define('ForumThread', {
27 extend: 'Ext.data.Model',
29 'title', 'forumtitle', 'forumid', 'author',
30 {name: 'replycount', type: 'int'},
31 {name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp'},
32 'lastposter', 'excerpt', 'threadid'
34 idProperty: 'threadid'
37 // create the Data Store
38 var store = Ext.create('Ext.data.Store', {
43 // allow the grid to interact with the paging scroller by buffering
46 // load using script tags for cross domain, if the data in on the same domain as
47 // this page, an HttpProxy would be better
49 url: 'http://www.sencha.com/forum/remote_topics/index.php',
55 totalProperty: 'totalCount'
57 // sends single sort as multi parameter
66 function renderTopic(value, p, record) {
67 return Ext.String.format(
68 '<a href="http://sencha.com/forum/showthread.php?t={2}" target="_blank">{0}</a>',
70 record.data.forumtitle,
77 var grid = Ext.create('Ext.grid.Panel', {
80 title: 'ExtJS.com - Browse Forums',
82 verticalScrollerType: 'paginggridscroller',
84 disableSelection: true,
85 invalidateScrollerOnRefresh: false,
95 // id assigned so we can apply custom css (e.g. .x-grid-cell-topic b { color:#333 })
96 // TODO: This poses an issue in subclasses of Grid now because Headers are now Components
97 // therefore the id will be registered in the ComponentManager and conflict. Need a way to
98 // add additional CSS classes to the rendered cells.
103 renderer: renderTopic,
113 dataIndex: 'replycount',
120 dataIndex: 'lastpost',
122 renderer: Ext.util.Format.dateRenderer('n/j/Y g:i A'),
125 renderTo: Ext.getBody()
128 // trigger the data store load
129 store.guaranteeRange(0, 199);