我用combobox写的代码如下
Ext.require([
'Ext.form.ComboBox',
'Ext.tip.QuickTips',
'Ext.data.*'
]);
Ext.onReady(function() {
Ext.tip.QuickTips.init(); // Define the model for a State
Ext.regModel('State', {
fields: [
{type: 'string', name: 'xh'},
{type: 'string', name: 'xm'}
]
}); // The data for all states
// The data store holding the states; shared by each of the ComboBox examples below
// var store = new Ext.data.Store({
// model: 'State',
// data: states
// }); var comboxStore = new Ext.data.Store({
model: 'State',
proxy: {
type:'ajax',
method:'post',
url: "http://localhost:8080/cjcx/servlet/Getcj?Method=GetAllxhxm" ,
reader:'json'
},
atuoLoad:false
} );
// comboxStore.load(); // ComboBox with a custom item template
var simple = new Ext.form.ComboBox({
fieldLabel: '请输入您的学号',
renderTo: 'simple',
displayField: 'xm',
valueField: 'name',
// hiddenName:'empUserNum',
allowBlank : false,
width: 500,
labelWidth: 130,
hideTrigger:true,
// typeAhead:true,//延时查询,与下面的参数配合
// typeAheadDelay:250,//默认250
blankText:'输入姓名查询成绩',
emptyText:'输入姓名查询成绩',
listEmptyText:'请仔细核对姓名信息',
minChars : 1,
store: comboxStore,
queryMode:'remote',
queryParam : 'empUserNum',
getInnerTpl: function() {
return '<div ext:qtip="{xh}"> {xm}</div>';
}
});
////// Collapsible code panels; ignore: ///// Ext.select('pre.code').each(function(pre) {
new Ext.form.FieldSet({
contentEl: pre,
renderTo: pre.parent(),
title: 'View code for this example',
collapsible: true,
collapsed: true
})
});});
后台java用的sevelet接受的数据 却发现调用的doGet 使用request.getParameter("empUserNum");获取的值居然是乱码
我测试了下 输入“张”后台获取值3个? 用myeclipse 调试 后台发现调用的始终是GET
Ext.require([
'Ext.form.ComboBox',
'Ext.tip.QuickTips',
'Ext.data.*'
]);
Ext.onReady(function() {
Ext.tip.QuickTips.init(); // Define the model for a State
Ext.regModel('State', {
fields: [
{type: 'string', name: 'xh'},
{type: 'string', name: 'xm'}
]
}); // The data for all states
// The data store holding the states; shared by each of the ComboBox examples below
// var store = new Ext.data.Store({
// model: 'State',
// data: states
// }); var comboxStore = new Ext.data.Store({
model: 'State',
proxy: {
type:'ajax',
method:'post',
url: "http://localhost:8080/cjcx/servlet/Getcj?Method=GetAllxhxm" ,
reader:'json'
},
atuoLoad:false
} );
// comboxStore.load(); // ComboBox with a custom item template
var simple = new Ext.form.ComboBox({
fieldLabel: '请输入您的学号',
renderTo: 'simple',
displayField: 'xm',
valueField: 'name',
// hiddenName:'empUserNum',
allowBlank : false,
width: 500,
labelWidth: 130,
hideTrigger:true,
// typeAhead:true,//延时查询,与下面的参数配合
// typeAheadDelay:250,//默认250
blankText:'输入姓名查询成绩',
emptyText:'输入姓名查询成绩',
listEmptyText:'请仔细核对姓名信息',
minChars : 1,
store: comboxStore,
queryMode:'remote',
queryParam : 'empUserNum',
getInnerTpl: function() {
return '<div ext:qtip="{xh}"> {xm}</div>';
}
});
////// Collapsible code panels; ignore: ///// Ext.select('pre.code').each(function(pre) {
new Ext.form.FieldSet({
contentEl: pre,
renderTo: pre.parent(),
title: 'View code for this example',
collapsible: true,
collapsed: true
})
});});
后台java用的sevelet接受的数据 却发现调用的doGet 使用request.getParameter("empUserNum");获取的值居然是乱码
我测试了下 输入“张”后台获取值3个? 用myeclipse 调试 后台发现调用的始终是GET
如果你要传中文可以 store.reload({params:searchParam });
searchParam 就是你拼接的参数数 如下 var searchParam = {search_code : search_code, search_fullname : search_fullname, search_addr : search_addr,
search_tel : search_tel , search_bossId : search_bossId, start: 0, limit: 15};
model: 'State',
proxy: {
type:'ajax',
method:'post'
url: "http://localhost:8080/cjcx/servlet/Getcj?Method=GetAllxhxm" ,
reader:'json'
},
atuoLoad:false
} ); 楼上请问这里的method‘post’是什么意思啊
type : 'ajax',// Ext.data.AjaxProxy
actionMethods : {
read : 'POST'
},
url : Matech.Config.comboUrl,
extraParams : {
autoId : me.autoId
}
}
type : 'ajax',// Ext.data.AjaxProxy
actionMethods : {
read : 'POST'
},
url : Matech.Config.comboUrl,
extraParams : {
autoId : me.autoId
}
}