我无法在 EXTJS 的多选框中显示条目。这是我的 EXTJS 多选和相应面板的代码:
var selectTrain = [{
bodyStyle: 'padding:10px;',
items:[{
xtype: 'multiselect',
fieldLabel: 'Multiselect',
name: 'multiselect',
width: 250,
height: 200,
id: 'selectTrain',
store: new Ext.data.JsonStore({
type: 'ajax',
url:'http://abc.com/xyz',
reader: 'json',
autoLoad:true
}),
ddReorder: true
}]
}];
// combine all that into one huge form
var fp = new Ext.FormPanel({
title: '',
frame: true,
labelWidth: 300,
width: 800,
renderTo:'report',
bodyStyle: 'padding:0 10px 0;',
items: [
{
layout: 'column',
border: false,
// defaults are applied to all child items unless otherwise specified by child item
defaults: {
columnWidth: '1',
border: false
},
items: [selectTrain]
},
],
buttons: [{
text: 'Go',
handler: function(){}
},{
text: 'Reset',
handler: function(){
fp.getForm().reset();
}
}]
});
我可以访问作为 servlet 的 URL http://abc.com/xyz并在 Firebug 控制台上看到以下 JSON:
{"54850":"5.1(1t)d1(3)","54852":"5.1(1t)a2(3)","54853":"5.1(1t)l2(1)","54841":"1.2(4)S1(1)","54789":"5.3(1)T","54849":"5.1(1t)s1(2)","54854":"5.1(1t)l2(5)","54855":"5.1(1t)s2(6)","54847":"1.1(12a)SG"}
http://abc.com/xyz的 servlet 代码是:
PrintWriter out = response.getWriter();
JSONObject jsonObj=new JSONObject();
for (Iterator iterator = allRelInfoPools.iterator(); iterator
.hasNext();) {
Vector v = (Vector) iterator.next();
jsonObj.put((String)v.get(0),(String)v.get(1));
}
out.println(jsonObj);
请告知,我哪里出错了?