我是靠谱客的博主 单薄狗,最近开发中收集的这篇文章主要介绍Extjs combo,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

Combo with Templates and Ajax
This is a more advanced example that shows how you can combine paging, Ext.Template and a remote data store to create a "live search" feature.

The js is not minified so it is readable. See forum-search.js .

-----------------------------------------------------------------------------------------------

/*!
* Ext JS Library 3.3.1
* Copyright(c) 2006-2010 Sencha Inc.
* licensing@sencha.com
* http://www.sencha.com/license
*/
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(
'<tpl for="."><div class="search-item">',
'<h3><span>{lastPost:date("M j, Y")}<br />by {author}</span>{title}</h3>',
'{excerpt}',
'</div></tpl>'
);

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);
}
});
});

-------------------------------------------------------------------------------------------------------------------------
{"totalCount":"317145","topics":[{"post_id":"585203","topic_title":"Work
at home and get weekly payments ( ID :
187)","topic_id":"128324","author":"ar.warrich","post_time":"1301376557","post_text":"We
offer Paypal, Western Union,MoneyGram For International Typists And as
well as for local typists./nWork at home typists needed now. Earn up to
$2 pe...","forum_title":"Ext: Open
Discussion","forumid":"6","reply_count":"0"},{"post_id":"585202","topic_title":"the
most acclaimed television series of all
time","topic_id":"128323","author":"amy001","post_time":"1301376394","post_text":"/"The
Sopranos/" Sopranos DVD
(http:www.dvdshop888.com//en//thrillers-crime-mystery-//the-sopranos-seasons-1-7-dvd-boxset.html)may
be the most acclaimed ...","forum_title":"Ext 1.x:
Help","forumid":"5","reply_count":"0"},{"post_id":"585198","topic_title":"TreePanel
with CRUD operations
example","topic_id":"128006","author":"amy001","post_time":"1301376107","post_text":"It
isPrison Break DVD
(http:www.dvdshop888.com//en//tv-series-dvd-boxset//prison-break-seasons-1-4-dvd-boxset.html)no
secret that Fox has a negative tr...","forum_title":"Ext: Examples and
Extras","forumid":"7","reply_count":"1"},{"post_id":"585196","topic_title":"extjs
editor grid column
header","topic_id":"127999","author":"madhuchowdary","post_time":"1301375490","post_text":"Hi,/n
I tried your solution but its not working for me.Iam defining column
model from xml and in image SRC iam giving the path of the image.Is
anythin...","forum_title":"Ext: Examples and
Extras","forumid":"7","reply_count":"4"},{"post_id":"585183","topic_title":"extjs
editor grid column
header","topic_id":"127999","author":"jratcliff","post_time":"1301373541","post_text":"You
don't have to pass anything to the renderer function. This is done for
you. All you have to do is define the renderer
function./r/n/r/nHowever, I do...","forum_title":"Ext: Examples and
Extras","forumid":"7","reply_count":"4"},{"post_id":"585181","topic_title":"extjs
editor grid column
header","topic_id":"127999","author":"madhuchowdary","post_time":"1301372479","post_text":"thanks
for your reply,here in render function what i need to return , I mean
image path?/nand what value i have to pass to the render
function?","forum_title":"Ext: Examples and
Extras","forumid":"7","reply_count":"4"},{"post_id":"585175","topic_title":"RegEx
to give error if there are script
tags","topic_id":"128223","author":"yenduttjain","post_time":"1301370175","post_text":"Can
you share the correct regex to give error only when Script tag is found
in the content?","forum_title":"Ext: Premium
Help","forumid":"11","reply_count":"4"},{"post_id":"585166","topic_title":"Legal
quesion? Quoting ext js code on
blog.","topic_id":"128317","author":"AslanB","post_time":"1301363492","post_text":"Hi,/n/nI
would like to quote sections of Ext Js on my blog as part of
documenting my analysis of the JavaScript language. Is there any legal
issues with...","forum_title":"Ext: Open
Discussion","forumid":"6","reply_count":"0"},{"post_id":"585157","topic_title":"Ext
4 accessibility
issues","topic_id":"128313","author":"alxyoyo","post_time":"1301360828","post_text":"In
doing research for a possible future project we're really liking the
prospect of Ext 4. We've been really impressed by the theming and the
DOM weig...","forum_title":"Ext 2.x:
Help","forumid":"9","reply_count":"0"},{"post_id":"585155","topic_title":"menu.showAt()
not
showing.","topic_id":"128312","author":"scaddenp","post_time":"1301360546","post_text":"I
am wanting a menu to show up when I click on an item in a grid panel.
The menu is also used on a toolbar for another window, so I find it
from ther...","forum_title":"Ext: Premium
Help","forumid":"11","reply_count":"0"}]}

最后

以上就是单薄狗为你收集整理的Extjs combo的全部内容,希望文章能够帮你解决Extjs combo所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(49)

评论列表共有 0 条评论

立即
投稿
返回
顶部