您的位置:首页 > 其它

基于Efs的SELECT 选择框的高级应用

2012-08-06 13:43 295 查看
1、引入规则

2、3种常规使用规则

3、多级联动的select

4、3种模式下如何给默认选择值;

// 这里给大家写了一个通用的函数,给默认赋值的
// 函数说明: 给指定的select对象默认赋值

// 参数说明: sSelectID select标签对象ID

// sValue 默认赋值的下拉对象的code值,

// fun 完成后的监听函数

// 默认让select选中第一个

function initSelect(sSelectID,sValue,fun)

{

// 获得combox对象

var combox = Efs.getExt(sSelectID);

if(combox.store.getCount() == 0) // 看是否有下拉数据

{

// 判断是否为 url 类型

if(Efs.getDom(sSelectID).getAttribute("url") != null)

{

// 查询数据

combox.doQuery();

combox.store.on("load",function(){

if(combox.store.getCount()>0)

if(typeof sValue != "undefined" && sValue != "") // sValue 给了值

combox.setValue(sValue);

else

combox.setValue(combox.store.getAt(0).get("value")); // 默认选择第一个

if(typeof fun != "undefined") {

eval(fun + "()");

}

});

}

else if(Efs.getDom(sSelectID).getAttribute("src") != null) // 字典模式

{

combox.doQuery();

if(typeof sValue != "undefined" && sValue != "")

combox.setValue(sValue);

else

combox.setValue(combox.store.getAt(0).get("value"));

}

}

else { // 普通模式

if(typeof sValue != "undefined" && sValue != "")

combox.setValue(sValue);

else

combox.setValue(combox.store.getAt(0).get("value"));

}

}

5、多级联动下,如在修改数据过程中,如何回填select值

备注:

扩展一些数据说明

1、给person表增加多级联动的必要数据如: 所属省 PROVINCE ,所属市 CITY ,

2、增加省市的数据表

湖北

武汉

宜昌

黄石

湖南

长沙

湘潭

娄底
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: