6 Ext.onReady(function(){
9 extend: 'Ext.data.Model',
12 url : 'http://www.sencha.com/forum/topics-remote.php',
16 totalProperty: 'totalCount'
21 {name: 'id', mapping: 'post_id'},
22 {name: 'title', mapping: 'topic_title'},
23 {name: 'topicId', mapping: 'topic_id'},
24 {name: 'author', mapping: 'author'},
25 {name: 'lastPost', mapping: 'post_time', type: 'date', dateFormat: 'timestamp'},
26 {name: 'excerpt', mapping: 'post_text'}
30 var ds = Ext.create('Ext.data.Store', {
36 var panel = Ext.create('Ext.panel.Panel', {
37 renderTo: Ext.getBody(),
38 title: 'Search the Ext Forums',
46 displayField: 'title',
53 loadingText: 'Searching...',
54 emptyText: 'No matching posts found.',
56 // Custom rendering template for each item
57 getInnerTpl: function() {
58 return '<div class="search-item">' +
59 '<h3><span>{[Ext.Date.format(values.lastPost, "M j, Y")]}<br />by {author}</span>{title}</h3>' +
66 // override default onSelect to do redirect
68 select: function(combo, selection) {
69 var post = selection[0];
72 Ext.String.format('http://www.sencha.com/forum/showthread.php?t={0}&p={1}', post.get('topicId'), post.get('id'));
78 style: 'margin-top:10px',
79 html: 'Live search requires a minimum of 4 characters.'