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});
16 Ext.Loader.setPath('Ext.ux', '../ux');
21 'Ext.layout.container.Fit',
23 'Ext.ux.form.SearchField'
27 extend: 'Ext.data.Model',
28 idProperty: 'post_id',
30 {name: 'postId', mapping: 'post_id'},
31 {name: 'title', mapping: 'topic_title'},
32 {name: 'topicId', mapping: 'topic_id'},
33 {name: 'author', mapping: 'author'},
34 {name: 'lastPost', mapping: 'post_time', type: 'date', dateFormat: 'timestamp'},
35 {name: 'excerpt', mapping: 'post_text'}
39 Ext.onReady(function(){
43 var store = Ext.create('Ext.data.Store', {
47 url: 'http://sencha.com/forum/topics-remote.php',
54 totalProperty: 'totalCount'
58 beforeload: function(){
59 var params = store.getProxy().extraParams;
61 delete params.forumId;
63 params.forumId = forumId;
70 var resultTpl = Ext.create('Ext.XTemplate',
72 '<div class="search-item">',
73 '<h3><span>{lastPost:this.formatDate}<br />by {author}</span>',
74 '<a href="http://sencha.com/forum/showthread.php?t={topicId}&p={postId}" target="_blank">{title}</a></h3>',
78 formatDate: function(value){
79 return Ext.Date.format(value, 'M j, Y');
83 var panel = Ext.create('Ext.panel.Panel', {
84 title: 'Forum Search',
87 renderTo: 'search-panel',
95 itemSelector: 'div.search-item'
102 fieldLabel: 'Search',
104 xtype: 'searchfield',
109 xtype: 'pagingtoolbar',
113 displayMsg: 'Topics {0} - {1} of {2}',
114 emptyMsg: 'No topics to display'