X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/ee06f37b0f6f6d94cd05a6ffae556660f7c4a2bc..c930e9176a5a85509c5b0230e2bff5c22a591432:/docs/source/forum-search.html diff --git a/docs/source/forum-search.html b/docs/source/forum-search.html new file mode 100644 index 00000000..089d814b --- /dev/null +++ b/docs/source/forum-search.html @@ -0,0 +1,53 @@ + + + The source code + + + + +
Ext.onReady(function(){
+
+    var ds = new Ext.data.Store({
+        proxy: new Ext.data.ScriptTagProxy({
+            url: 'http://extjs.com/forum/topics-remote.php'
+        }),
+        reader: new Ext.data.JsonReader({
+            root: 'topics',
+            totalProperty: 'totalCount',
+            id: 'post_id'
+        }, [
+            {name: 'title', mapping: 'topic_title'},
+            {name: 'topicId', mapping: 'topic_id'},
+            {name: 'author', mapping: 'author'},
+            {name: 'lastPost', mapping: 'post_time', type: 'date', dateFormat: 'timestamp'},
+            {name: 'excerpt', mapping: 'post_text'}
+        ])
+    });
+
+    // Custom rendering Template
+    var resultTpl = new Ext.XTemplate(
+        '
', + '

{lastPost:date("M j, Y")}
by {author}
{title}

', + '{excerpt}', + '
' + ); + + var search = new Ext.form.ComboBox({ + store: ds, + displayField:'title', + typeAhead: false, + loadingText: 'Searching...', + width: 570, + pageSize:10, + hideTrigger:true, + tpl: resultTpl, + applyTo: 'search', + itemSelector: 'div.search-item', + onSelect: function(record){ // override default onSelect to do redirect + window.location = + String.format('http://extjs.com/forum/showthread.php?t={0}&p={1}', record.data.topicId, record.id); + } + }); +});
+ + \ No newline at end of file