问下ajax的下拉菜单的问题
我现在的要在jsp实现的功能是实现一个下拉框,比如说页面展现name,选择后,传递值为id,实现不了,不知道ext里面怎么写,请大家帮忙下
我是用spring和dwr从service取值,service是这么写的:
public CoreDept[] getdepts() {
CoreDept[] depts = this.getAll().toArray(new CoreDept[]{});
return depts;
}
jsp页面:
<script src="${ctx}/dwr/interface/kzcFilialeService.js" type="text/javascript"></script>
<script type="text/javascript">
Ext.onReady(function(){
//alert(kzcFilialeService.getdepts);
kzcFilialeService.getdepts(function(typeList){
alert(typeList);//这里typeList:就是service返回的depts。取得到值,是一个数组
for(var i=0;i<typeList.length;i++){
//mytype[i] = [typeList[i]];
alert(typeList[i].deptname+"--")//这里取不到值,
}
}
alert(typeList+"----");
var store = new Ext.data.SimpleStore({
fields: ['oid','deptname','depttype'],//这里我Coredept的属性,这里的写法不知道错没有
data : typeList
});
alert(store+"-----");
//下面的报错。
var fs=new Ext.form.ComboBox({
store: store,
hiddenName :'oid',
displayField:'deptname',
triggerAction: 'all',
mode:'local',
selectOnFocus:true,
width:135,
applyTo:'filoid'
});*//*
});
});
</script>
<tr>
<td class="propLable">所属分公司:</td>
<td><ww:textfield name="filoid" cssStyle="width:100%" /></td><td><font color="red">*</font></td></tr>