送达站和终到站联动,选定送达站后 自动过滤送达站下所属的站点
以下是我的代码 var combo_sdzjyd = new Ext.form.ComboBox({
store:sdzjyd_Store,
id:'sdz_add',
name:'sdz_add',
hiddenName:'com_sdzjydhidden',
fieldLabel:'送达站',
width:85,
typeAhead: true,
emptyText:'请选择...',
triggerAction:'all',
valueField:'id',
displayField:'name',
selectOnFocus:true,
allowBlank:false,
mode:'remote',
blankText:'请选择送达站',
listeners:{
//'Select':function(combo){sdzjyd_Store.load();}
'blur':function(combo,record,index){
var sdzbm = Ext.getCmp("sdz_add").getValue();
zdzjyd_Store.reload({params:{sdzbm:sdzbm}})
}
}
});
//终到站--------------------------------------------------
var comzdzjyd_httpProxy = new Ext.data.HttpProxy({
url : "Data/dangan/GetZdzAdd.aspx"
});
var comzdzjyd_create = new Ext.data.Record.create([{
name : "id"
}, {
name : "name"
}]); var comzdzjyd_jsonReader = new Ext.data.JsonReader({
totalProperty : "totalProperty", // 总记录数
root : "data" // 所有的数据(json对象数组)
}, comzdzjyd_create) var zdzjyd_Store = new Ext.data.Store({
proxy : comzdzjyd_httpProxy,
reader : comzdzjyd_jsonReader
});
zdzjyd_Store.load();
GetZdzAdd.aspx.cs代码
string sdzbm = Request.Params["sdzbm"].ToString();
DataSet ds = sqlHelp.GetDataSet("select id,name from bm_zdxx where sfdz=1 and parentid='"+sdzbm+"'");
foreach (DataRow row in ds.Tables[0].Rows)
{
json.AddItem("id", row["id"].ToString());
json.AddItem("name", row["name"].ToString());
json.ItemOk(); jsons = json.ToString();
}
Response.Write(jsons);每次刚运行时 就提示红色行 “未将对象引用设置到对象的实例”
以下是我的代码 var combo_sdzjyd = new Ext.form.ComboBox({
store:sdzjyd_Store,
id:'sdz_add',
name:'sdz_add',
hiddenName:'com_sdzjydhidden',
fieldLabel:'送达站',
width:85,
typeAhead: true,
emptyText:'请选择...',
triggerAction:'all',
valueField:'id',
displayField:'name',
selectOnFocus:true,
allowBlank:false,
mode:'remote',
blankText:'请选择送达站',
listeners:{
//'Select':function(combo){sdzjyd_Store.load();}
'blur':function(combo,record,index){
var sdzbm = Ext.getCmp("sdz_add").getValue();
zdzjyd_Store.reload({params:{sdzbm:sdzbm}})
}
}
});
//终到站--------------------------------------------------
var comzdzjyd_httpProxy = new Ext.data.HttpProxy({
url : "Data/dangan/GetZdzAdd.aspx"
});
var comzdzjyd_create = new Ext.data.Record.create([{
name : "id"
}, {
name : "name"
}]); var comzdzjyd_jsonReader = new Ext.data.JsonReader({
totalProperty : "totalProperty", // 总记录数
root : "data" // 所有的数据(json对象数组)
}, comzdzjyd_create) var zdzjyd_Store = new Ext.data.Store({
proxy : comzdzjyd_httpProxy,
reader : comzdzjyd_jsonReader
});
zdzjyd_Store.load();
GetZdzAdd.aspx.cs代码
string sdzbm = Request.Params["sdzbm"].ToString();
DataSet ds = sqlHelp.GetDataSet("select id,name from bm_zdxx where sfdz=1 and parentid='"+sdzbm+"'");
foreach (DataRow row in ds.Tables[0].Rows)
{
json.AddItem("id", row["id"].ToString());
json.AddItem("name", row["name"].ToString());
json.ItemOk(); jsons = json.ToString();
}
Response.Write(jsons);每次刚运行时 就提示红色行 “未将对象引用设置到对象的实例”
Extjs看懂了 asp没有看懂。
是参数没有传到后台
还是?
是啊 一运行就报错“未将对象引用设置到对象的实例”string sdzbm = Request.Params["sdzbm"].ToString();
就是这行 第一次都没有接收到参数
url : "Data/dangan/GetZdzAdd.aspx"
});
顶一下,lz sdzjyd_Store里应该加个callback事件,就不会有空值的情况了顺便 问下,谁有 不是 ajax 方法的combox 的二级 联动 ?