3 * Copyright(c) 2006-2010 Ext JS, Inc.
5 * http://www.extjs.com/license
7 Ext.onReady(function(){
8 var ds = new Ext.data.Store({
9 proxy: new Ext.data.ScriptTagProxy({
10 url: 'http://extjs.com/forum/topics-remote.php'
12 reader: new Ext.data.JsonReader({
14 totalProperty: 'totalCount',
17 {name: 'postId', mapping: 'post_id'},
18 {name: 'title', mapping: 'topic_title'},
19 {name: 'topicId', mapping: 'topic_id'},
20 {name: 'author', mapping: 'author'},
21 {name: 'lastPost', mapping: 'post_time', type: 'date', dateFormat: 'timestamp'},
22 {name: 'excerpt', mapping: 'post_text'}
25 baseParams: {limit:20, forumId: 4}
28 // Custom rendering Template for the View
29 var resultTpl = new Ext.XTemplate(
31 '<div class="search-item">',
32 '<h3><span>{lastPost:date("M j, Y")}<br />by {author}</span>',
33 '<a href="http://extjs.com/forum/showthread.php?t={topicId}&p={postId}" target="_blank">{title}</a></h3>',
38 var panel = new Ext.Panel({
39 applyTo: 'search-panel',
44 items: new Ext.DataView({
47 itemSelector: 'div.search-item'
52 new Ext.ux.form.SearchField({
58 bbar: new Ext.PagingToolbar({
62 displayMsg: 'Topics {0} - {1} of {2}',
63 emptyMsg: "No topics to display"
67 ds.load({params:{start:0, limit:20, forumId: 4}});