ComboBox联动 (AJAX BS实现)
//从webservice中取数据ajax
Ext.Ajax.request({
url: 'WebService.asmx/GetComboxFirst',
method: 'POST',
//jsonData: { UserName: "" },
headers: { 'Content-Type': 'application/json;utf-8' },
success: General,
failure: On_Error
});
function General(result) {
var data = Ext.util.JSON.decode(result.responseText);
var ds = new Ext.data.Store({
proxy: new Ext.data.MemoryProxy(data.d),
reader: new Ext.data.JsonReader({ fields: [{ name: 'strText', type: 'string' }, { name: 'strValue', type: 'string'}] })
});
ds.load();
var combox1 = new Ext.form.ComboBox({
store: ds,
displayField: 'strText',
valueField: 'strValue',
typeAhead: true,
mode: 'local',
forceSelection: true,
triggerAction: 'all',
emptyText: 'Select a state...',
selectOnFocus: true,
applyTo: 'combox1'
});
Genercombox2("1", 5);
combox1.on('select', function (comboBox) {
//alert(comboBox.getRawValue() + '-' + comboBox.getValue());
Genercombox2("2", comboBox.getValue());
});
};
function On_Error() {
};
//从webservice中取数据ajax
//从webserivce中取通过HttpProxy,因为asp.net数据是放在.d里面的,所以需要重写JsonReader来取数据.
bJsonReader = Ext.extend(Ext.data.JsonReader, {
read: function (response) {
var json = response.responseText;
//alert(json);
var o = Ext.decode(json);
//alert(o.d);
this.responseText = json;
if (!o) {
throw { message: 'JsonReader.read: Json object not found' };
}
return this.readRecords(o.d);
}
});
var dshttpProxy = new Ext.data.Store({
proxy: new Ext.data.HttpProxy({
url: "WebService.asmx/GetComboxFirstByParam", method: 'POST', jsonData: { strParam: 10 }
}),
reader: new bJsonReader({
fields: [{ name: 'strText', type: 'string' }, { name: 'strValue', type: 'string'}]
})
});
function Genercombox2(strtype, indexvalue) {
if (strtype == "1") {
var combox2 = new Ext.form.ComboBox({
store: dshttpProxy,
displayField: 'strText',
autoLoad: false,
valueField: 'strValue',
typeAhead: true,
mode: 'local',
id: 'gameAreaID',
forceSelection: true,
triggerAction: 'all',
emptyText: 'Select a state...',
loadingText: 'Please Select',
anchor: '100%',
selectOnFocus: true,
applyTo: 'combox2'
});
}
if (strtype == "2") {
var parent = Ext.getCmp('gameAreaID');
parent.reset();
//重新获取数据
dshttpProxy.proxy = new Ext.data.HttpProxy({
url: "WebService.asmx/GetComboxFirstByParam", method: 'POST', jsonData: { strParam: indexvalue }
});
dshttpProxy.load();
}
}
//从webserivce中取通过HttpProxy
ComboBox联动 (AJAX BS实现)的更多相关文章
- vs2013+MVC3.0+EasyUI的ComboBox联动使用(二)
vs2013+MVC3.0+EasyUI的ComboBox联动使用(二) 简单介绍:在vs2013(.net4.0)中使用MVC3.0对于EasyUI中ComboBox的联动使用. 载入Comb ...
- Extjs4 Combobox 联动始终出现loading错误的解决的方法
当反复选者combobox 联动时,下级的Combobox 会出现loading的错误表现形式,尽管Store数据已载入完也是一样. 废话少说贴代码就知道怎样处理了:(注意红色部分的关键语句) }, ...
- Ext 4.2以后版本 ComboBox 联动
//combox树 ComboTree: function (upDep, empStore) { var com = Ext.create('Ext.ux.desktop.ComboTree', { ...
- C# Combobox联动
接上一篇博文,对界面做一个小修改,做4个combobox,形成窗口之间的联动: 界面如下: 选择combobox里的条件,单击查询获取数据 首先连接数据库,获取到数据到第一个combobox里,代码在 ...
- TopJUI Combobox 联动
这里给联动进行一个简单定义:因Combobox选择或输入的值发生改变时对自身或者其它组件产生影响称为联动.(注:editable确定是否可以手动输入) 有两种实现方法: 一.自己写对应的onChang ...
- 练习: 省市联动(Ajax)
// 示例一: china.xml (位于 src 目录下) <?xml version="1.0" encoding="utf-8"?> < ...
- JS 省市联动 ajax
省市联动 //省市联动 $('.locationCode').change(function () { var val = $(this).val(); if ...
- Extjs之combobox联动
Ext.Loader.setConfig({ enabled : true }); Ext.Loader.setPath('Ext.ux', '../extjs/ux'); Ext.require([ ...
- jquery多级联动(ajax查数据库)
/id 代表下级下拉框ID,cityCode代表的是父级菜单代码,所有级菜单在同一张表,后台在加载是把菜单已经加入到Map缓存中.... //id 代表下级下拉框ID,cityCode代表的是父级菜单 ...
随机推荐
- Redis集群模式配置
redis集群部署安装: https://blog.csdn.net/huwh_/article/details/79242625 https://www.cnblogs.com/mafly/p/re ...
- msp430项目编程41
msp430综合项目---红外遥控直流电机调速系统41
- golang导出Excel表格
设置样式: package main import ( "github.com/tealeg/xlsx" "fmt" ) func main() { var f ...
- Delphi+MySQL:TADOQuery使用插入中文乱码解决方法
Delphi+MySQL:TADOQuery使用插入中文乱码解决方法 with adoquery dobeginclose;sql.clear;sql.text:=' insert into test ...
- (46)C#注册表及读写
启动注册表:regedit 结构: 注册表一共有7个配置单元用regedit只能看到5个 HKEY_CLASSES_ROOT 包含系统上文件类型的细节(.txt,.doc)等.以及使用那些应用程序可以 ...
- 程序防止SqlServer使用SqlServer Profiler跟踪
思路: 1.使用默认函数(fn_trace_getinfo)查询跟踪列表: 2.调用系统存储过程(sp_trace_setstatus)修改跟踪状态. 相关Sql : declare @default ...
- nginx源码学习资源(不断更新)转
原文地址:http://www.cnblogs.com/yjf512/archive/2012/06/13/2548515.html nginx源码学习是一个痛苦又快乐的过程,下面列出了一些nginx ...
- 2.JAVA语言基础部分
1.语言基础 二进制操作 "&"按位与:a与b同时为1结果为1,否则为0: "|"按位或:a与b其中任一个为1,否则为0 "~"按位 ...
- 【IntelliJ IDEA】2017.3.4版本永久破解
[本版本软件包和破解jar在网盘上有 我的网盘--技术--idea破解所需要的] 1.idea官网下载 历史版本 选择2017.3.4版本下载 https://www.jetbrains.com ...
- Mysql数据库中CURRENT_TIMESTAMP和ON UPDATE CURRENT_TIMESTAMP区别
如图所示,mysql数据库中,当字段类型为timestamp时,如果默认值取CURRENT_TIMESTAMP,则在insert一条记录时,end_time的值自动设置为系统当前时间,如果勾选了 ON ...