3 * Copyright(c) 2006-2010 Ext JS, LLC
5 * http://www.extjs.com/license
7 Ext.onReady(function(){
9 var ds = new Ext.data.Store({
10 proxy: new Ext.data.ScriptTagProxy({
11 url: 'http://extjs.com/forum/topics-remote.php'
13 reader: new Ext.data.JsonReader({
15 totalProperty: 'totalCount',
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'}
26 // Custom rendering Template
27 var resultTpl = new Ext.XTemplate(
28 '<tpl for="."><div class="search-item">',
29 '<h3><span>{lastPost:date("M j, Y")}<br />by {author}</span>{title}</h3>',
34 var search = new Ext.form.ComboBox({
38 loadingText: 'Searching...',
44 itemSelector: 'div.search-item',
45 onSelect: function(record){ // override default onSelect to do redirect
47 String.format('http://extjs.com/forum/showthread.php?t={0}&p={1}', record.data.topicId, record.id);