ext 省市联动菜单
2009-12-16 10:41
323 查看
function getComboBox(store, valueF, displayF, label, name) {
return new Ext.form.ComboBox({
store: store,
fieldLabel: label,
allowBlank: false,
forceSelection: true,
valueField: valueF, // option.value
typeAhead: true,
displayField: displayF, // option.text
triggerAction: 'all',
emptyText: '请选择',
mode: 'local',
selectOnFocus: true,
width: 200,
name: name
});
}
function getRenderer(store, valueF, displayF) {
return function(value) {
var indexofvalue = store.find(valueF, value);
if (indexofvalue >= 0)
return store.getAt(indexofvalue).get(displayF);
return "未知项";
}
}
function getJsonStore(valueF, displayF, tablename) {
return new Ext.data.JsonStore({
root: 'list',
totalProperty: 'totalCount',
idProperty: valueF,
remoteSort: true,
fields: [
{ name: valueF }, { name: displayF }
],
proxy: new Ext.data.ScriptTagProxy({
url: '/management/procrequest/Proc_' + tablename + '.ashx?action=getlist'
})
});
}
function getAreaCombox(name) {
areakeyvalstore = getAreaStore("areaId", "areaName", 't_area',1);
return getComboBox(areakeyvalstore, 'areaId', 'areaName', '省', name);
}
var citystore;
function getCityCombox(name) {
citystore = getAreaStore("areaId", "areaName", 't_area',110000);
return getComboBox(citystore, 'areaId', 'areaName', '市', name);
}
//获得省列表
var pCombox = getAreaCombox("pAreaId");
var cityCombox = getCityCombox("areaIdtmp");
pCombox.store.load({
params: { "parentId[eq]": 1 }
});
//如果省列表选中了一项,则重新加载市列表
pCombox.on('select', function(box, newvar, oldvar){
cityCombox.setValue('');
cityCombox.store.reload({
params: { "parentId[eq]": pCombox.getValue() }
});
});
return new Ext.form.ComboBox({
store: store,
fieldLabel: label,
allowBlank: false,
forceSelection: true,
valueField: valueF, // option.value
typeAhead: true,
displayField: displayF, // option.text
triggerAction: 'all',
emptyText: '请选择',
mode: 'local',
selectOnFocus: true,
width: 200,
name: name
});
}
function getRenderer(store, valueF, displayF) {
return function(value) {
var indexofvalue = store.find(valueF, value);
if (indexofvalue >= 0)
return store.getAt(indexofvalue).get(displayF);
return "未知项";
}
}
function getJsonStore(valueF, displayF, tablename) {
return new Ext.data.JsonStore({
root: 'list',
totalProperty: 'totalCount',
idProperty: valueF,
remoteSort: true,
fields: [
{ name: valueF }, { name: displayF }
],
proxy: new Ext.data.ScriptTagProxy({
url: '/management/procrequest/Proc_' + tablename + '.ashx?action=getlist'
})
});
}
function getAreaCombox(name) {
areakeyvalstore = getAreaStore("areaId", "areaName", 't_area',1);
return getComboBox(areakeyvalstore, 'areaId', 'areaName', '省', name);
}
var citystore;
function getCityCombox(name) {
citystore = getAreaStore("areaId", "areaName", 't_area',110000);
return getComboBox(citystore, 'areaId', 'areaName', '市', name);
}
//获得省列表
var pCombox = getAreaCombox("pAreaId");
var cityCombox = getCityCombox("areaIdtmp");
pCombox.store.load({
params: { "parentId[eq]": 1 }
});
//如果省列表选中了一项,则重新加载市列表
pCombox.on('select', function(box, newvar, oldvar){
cityCombox.setValue('');
cityCombox.store.reload({
params: { "parentId[eq]": pCombox.getValue() }
});
});
相关文章推荐
- 省市联动菜单的源代码实现(access数据库版)
- 省市二级联动菜单javascript版
- JS省市二级联动菜单,sky整理收集。
- JS省市二级联动网页特效菜单
- 基于javascript实现全国省市二级联动下拉选择菜单
- 整理:dotNet Ajax实现无刷新省市县三级联动菜单
- ajax菜单,下拉菜单,下拉框,省市联动终极解决方案(经典收藏)
- JQuery EasyUI Combobox 实现省市二级联动菜单
- JS省市联动菜单代码
- Ext.Net.SelectBox菜单联动
- JS来实现省市县三级联动菜单
- 省市联动菜单的源代码实现(access数据库版)
- Jquery实现仿京东商城省市联动菜单
- JavaScript二维数组实现的省市联动菜单
- EXCEL如何做类似省市联动的二级选择菜单?
- [js]实现简单的省市二级联动下拉选择菜单
- 省市县三级分类联动菜单
- 省市二级菜单联动,下部显示对应相关内容(类宝岛眼镜)
- c#结合js实现无刷新省市联动菜单
- JavaScript-省市县三级联动菜单