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
9 var ds = new Ext.data.Store({
\r
10 proxy: new Ext.data.ScriptTagProxy({
\r
11 url: 'http://extjs.com/forum/topics-remote.php'
\r
13 reader: new Ext.data.JsonReader({
\r
15 totalProperty: 'totalCount',
\r
18 {name: 'postId', mapping: 'post_id'},
\r
19 {name: 'title', mapping: 'topic_title'},
\r
20 {name: 'topicId', mapping: 'topic_id'},
\r
21 {name: 'author', mapping: 'author'},
\r
22 {name: 'lastPost', mapping: 'post_time', type: 'date', dateFormat: 'timestamp'},
\r
23 {name: 'excerpt', mapping: 'post_text'}
\r
26 baseParams: {limit:20, forumId: 4}
\r
29 // Custom rendering Template for the View
\r
30 var resultTpl = new Ext.XTemplate(
\r
32 '<div class="search-item">',
\r
33 '<h3><span>{lastPost:date("M j, Y")}<br />by {author}</span>',
\r
34 '<a href="http://extjs.com/forum/showthread.php?t={topicId}&p={postId}" target="_blank">{title}</a></h3>',
\r
39 var panel = new Ext.Panel({
\r
40 applyTo: 'search-panel',
\r
41 title:'Forum Search',
\r
45 items: new Ext.DataView({
\r
48 itemSelector: 'div.search-item'
\r
53 new Ext.ux.form.SearchField({
\r
59 bbar: new Ext.PagingToolbar({
\r
63 displayMsg: 'Topics {0} - {1} of {2}',
\r
64 emptyMsg: "No topics to display"
\r
68 ds.load({params:{start:0, limit:20, forumId: 4}});
\r