其他分享
首页 > 其他分享> > 字典动态复选框解决策略:

字典动态复选框解决策略:

作者:互联网

html:

 

js:

 

//创建字典复选框
    //contain:容器JQ对象,
    //dictCode:字典编码
    //excludeList:要排除不显示的字典数据编码列表
    function addDictDataToCheckBox(contain,dictCode,excludeList,name){
        var list=[];
        if(excludeList!=undefined && excludeList!=null){
            list=excludeList;
        }
        var dictDataObj=greathack.getSessionData("dict")[dictCode];
        contain.html("");
        for(var key in dictDataObj){
            if(!isInList(key,list)){
                contain.append('<input type="checkbox" name="'+name+'" value="'+key+'" lay-skin="primary" title="'+dictDataObj[key].dataName+'">');
            }
        }
        form.render("checkbox");
    }

    addDictDataToCheckBox($(".xxType"),"AXEDG_XX_TYPE",null,"xxType");

var xxType = 0;
        $(".xxType").find("input[type=checkbox]:checked").each(function(){
            xxType+=JSON.stringify(this.value);
        });
        data.xxType=xxType;
        var layerIndex = layer.load();

控制层不做额外处理;

 

标签:dictCode,excludeList,xxType,复选框,contain,var,动态,字典
来源: https://www.cnblogs.com/rgectx/p/13371947.html