初学extjs,combo的datastore如果为SimpleStore是,下拉选择正常,
如果把datastore换成hpptProxy,可以下来所有数据,但单击选择时只不管我选择哪个值只能得到第一条数据值,
datastore的valueField是不同的,
界面如下:
json返回的数据如下:
{totalCount:11,success:true,error:"",singleInfo:"",data:[{"DisplayField":"河南1","ValueyField":"河南1"},{"DisplayField":"河南11","ValueyField":"河南11"},{"DisplayField":"河南2","ValueyField":"河南2"},{"DisplayField":"河南3","ValueyField":"河南3"},{"DisplayField":"河南4","ValueyField":"河南4"},{"DisplayField":"河南5","ValueyField":"河南5"},{"DisplayField":"河南8","ValueyField":"河南8"},{"DisplayField":"偃师10","ValueyField":"偃师10"},{"DisplayField":"偃师6","ValueyField":"偃师6"},{"DisplayField":"偃师7","ValueyField":"偃师7"},{"DisplayField":"偃师9","ValueyField":"偃师9"}]}js源码:
var storeRegiPlace = new Ext.data.Store({
proxy: new Ext.data.HttpProxy //定义读取数据的接口
({
url: "../URL/EmployeeURL.aspx?op=seleRegiplace"
}),
reader: new Ext.data.JsonReader //读取的后台数据存储到记data
({
totalProperty: 'totalCount',
root: 'data'
}, ['DisplayField', 'ValueFiled'])
}); //end store
......
items:
{
xtype: "combo",
name: "Regi_place",
id: "Regiplace",
triggerAction: "all",
fieldLabel: "户口",
anchor: "90%",
store: storeRegiPlace,
//pageSize: 10,
minListWidth: 230,
minChars: 4, //reload
displayField: "DisplayField",
valueField: "ValueField",
selectOnFocus: true,
mode: 'remote',
typeAhead: true,
emptyText: '请选择或输入户口所在地'
}请问哪里出问题了呢?
如果把datastore换成hpptProxy,可以下来所有数据,但单击选择时只不管我选择哪个值只能得到第一条数据值,
datastore的valueField是不同的,
界面如下:
json返回的数据如下:
{totalCount:11,success:true,error:"",singleInfo:"",data:[{"DisplayField":"河南1","ValueyField":"河南1"},{"DisplayField":"河南11","ValueyField":"河南11"},{"DisplayField":"河南2","ValueyField":"河南2"},{"DisplayField":"河南3","ValueyField":"河南3"},{"DisplayField":"河南4","ValueyField":"河南4"},{"DisplayField":"河南5","ValueyField":"河南5"},{"DisplayField":"河南8","ValueyField":"河南8"},{"DisplayField":"偃师10","ValueyField":"偃师10"},{"DisplayField":"偃师6","ValueyField":"偃师6"},{"DisplayField":"偃师7","ValueyField":"偃师7"},{"DisplayField":"偃师9","ValueyField":"偃师9"}]}js源码:
var storeRegiPlace = new Ext.data.Store({
proxy: new Ext.data.HttpProxy //定义读取数据的接口
({
url: "../URL/EmployeeURL.aspx?op=seleRegiplace"
}),
reader: new Ext.data.JsonReader //读取的后台数据存储到记data
({
totalProperty: 'totalCount',
root: 'data'
}, ['DisplayField', 'ValueFiled'])
}); //end store
......
items:
{
xtype: "combo",
name: "Regi_place",
id: "Regiplace",
triggerAction: "all",
fieldLabel: "户口",
anchor: "90%",
store: storeRegiPlace,
//pageSize: 10,
minListWidth: 230,
minChars: 4, //reload
displayField: "DisplayField",
valueField: "ValueField",
selectOnFocus: true,
mode: 'remote',
typeAhead: true,
emptyText: '请选择或输入户口所在地'
}请问哪里出问题了呢?
解决方案 »
- 为何JS编码无错,IE8浏览器无反映?新人请教
- jQuery.post( url,data,success()] 为什么用这个提交表单请求时候表单的值不会存入session里?
- AJAX请求后获得html放入指定位置
- 苹果官网的一个网页,谁知道是用什么技术实现的?告诉我一下,小弟在此谢过!
- 用JS的onclick怎么实现局部更新数据?
- 高手,帮忙解决这个JavaScript运行问题,急!!
- object.click()可以触发object的单击事件, 那什么方法可以触发双击事件呢?
- 怎麼在保持原table內容時在table加入一行<tr></tr>???
- 在HTML文件中嵌入JSP,用来检测注册的各个项目的数据有效性,怎么做?
- 关于打印页面指定位置的问题
- exths combo 选择问题
- 请问用ExtJS在一个页面做模块权限控制如何实现,麻烦给点思路
var typeStores = new Ext.data.Store({
url: '<%=Url.Action("LoadTypes", "TypeInfo") %>',
reader: new Ext.data.JsonReader({
id: 'Id'
}, ['Id', 'TypeName']),
remoteSort: false
});
typeStores.load(); var txtCaseType = new Ext.form.ComboBox({
fieldLabel: '<font color="red">*</font>案件类型',
store: typeStores,
name: 'CaseTypeId',
hiddenName: 'CaseTypeId',
valueField: 'Id',
displayField: 'TypeName',
typeAhead: true,
mode: 'remote',
triggerAction: 'all',
emptyText: '---请选择类型---',
selectOnFocus: true,
allowBlank: false,
width: 200
});