87,993
社区成员
发帖
与我相关
我的任务
分享Ext.regModel("BookInfo", {
fields: [{ name: "bookName" }]
});
var bookStore = Ext.create("Ext.data.Store", {
model: "BookInfo",
proxy: {
type: "ajax",
url: "bookSearchServer.ashx",
reader: new Ext.data.ArrayReader({model:"BookInfo"})
}
});
Ext.create("Ext.form.Panel", {
title: "combobox远程数据源示例",
frame: true,
height: 100,
width: 270,
renderTo: Ext.getBody(),
bodyPadding: 5,
defaults: {
labelSperator:":",
labelWidth: 70,
width: 200,
labelAlign:"left"
},
items: [
{
xtype: "combo",
fieldLabel: "书籍列表",
listConfig: {
loadingText: "正在加载书籍信息",
empty: "未找到匹配值",
maxHegiht:60
},
allQuery: "allbook",
minChars: 3,
queryDelay: 300,
queryParam: "searchbook",
triggerAction: "all",
store: bookStore,
displayField: "bookName",
valueField: "bookName",
queryMode:"remote"
}
]
});context.Response.ContentType = "text/plain";
String bookName = context.Request.QueryString["searchbook"];
//String bookName = context.Request.Form["searchbook"];
String jav = "['java变成思想'],['java入门'],['javascriptr程序设计']";
String cpp = "['c++编程思想'],['c++入门'],['c++程序设计']";
String php = "['php程序设计'],['php入门'],['phph从入门到精通']";
String books = "";
if (bookName.Equals("allbook"))
{
books = "[" + jav + "," + cpp + "," + php + "]";
context.Response.Write(books);
return;
}
else
{
bookName = bookName.Substring(0, 3);
if (bookName.Equals("jav"))
{
books = "[" + jav + "]";
}
else if (bookName.Equals("c++"))
{
context.Response.Write(bookName);
books = "[" + cpp + "]";
}
else if (bookName.Equals("php"))
{
books = "[" + php + "]";
}
else
{
context.Response.Write(bookName);
}
}
context.Response.Write(books);