3 <title>The source code</title>
\r
4 <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
\r
5 <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
\r
7 <body onload="prettyPrint();">
\r
8 <pre class="prettyprint lang-js">Ext.onReady(function(){
\r
10 var store = new Ext.data.Store({
\r
12 baseParams: {lightWeight:true,ext: 'js'},
\r
13 sortInfo: {field:'lastpost', direction:'DESC'},
\r
14 autoLoad: {params:{start:0, limit:500}},
\r
16 proxy: new Ext.data.ScriptTagProxy({
\r
17 url: 'http://extjs.com/forum/topics-browse-remote.php'
\r
20 reader: new Ext.data.JsonReader({
\r
22 totalProperty: 'totalCount',
\r
23 idProperty: 'threadid',
\r
25 'title', 'forumtitle', 'forumid', 'author',
\r
26 {name: 'replycount', type: 'int'},
\r
27 {name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp'},
\r
28 'lastposter', 'excerpt'
\r
33 var grid = new Ext.grid.GridPanel({
\r
34 renderTo: 'topic-grid',
\r
38 title:'ExtJS.com - Browse Forums',
\r
39 trackMouseOver:false,
\r
40 autoExpandColumn: 'topic',
\r
43 columns: [new Ext.grid.RowNumberer({width: 30}),{
\r
48 renderer: renderTopic,
\r
52 dataIndex: 'replycount',
\r
58 header: "Last Post",
\r
59 dataIndex: 'lastpost',
\r
61 renderer: renderLast,
\r
65 bbar: new Ext.PagingToolbar({
\r
71 view: new Ext.ux.grid.BufferView({
\r
72 // custom row height
\r
74 // render rows as they come into viewable area.
\r
81 function renderTopic(value, p, record){
\r
82 return String.format(
\r
83 '<b><a href="http://extjs.com/forum/showthread.php?t={2}" target="_blank">{0}</a></b><a href="http://extjs.com/forum/forumdisplay.php?f={3}" target="_blank">{1} Forum</a>',
\r
84 value, record.data.forumtitle, record.id, record.data.forumid);
\r
86 function renderLast(value, p, r){
\r
87 return String.format('{0}<br/>by {1}', value.dateFormat('M j, Y, g:i a'), r.data['lastposter']);
\r