qq_27446037
qq_27446037
2015-12-18 02:43

为什么点击文字时,相应的radio或者是checkbox没有勾选

  • ztree
  • checkbox
  • radio

代码如下
//第一个树
if(<%=value1%>!="1"){
var setting1 = {
check: {
enable: true,
chkStyle: "<%=chose1%>",
<%=type1%>Type: <%=typeValue1%>
},
view: {
dblClickExpand: false
},
data: {
simpleData: {
enable: true
}
},
callback: {
beforeClick: beforeClick,
onCheck: onCheck,

        }
    };
    var zNodes1 =<%=value1%>;
    function beforeClick(treeId, treeNode) {
        var zTree = $.fn.zTree.getZTreeObj("treeDemo1");
        if(treeNode.id.indexOf(".")==-1){
            zTree.expandNode(treeNode);
        }else if(treeNode.id.indexOf(".")!=-1 &&treeNode.id.length == 3 ){
            zTree.expandNode(treeNode);
        }else{
            zTree.checkNode(treeNode, !treeNode.checked, null, true);
        }
        return false;
    }
        function onCheck(e,treeId,treeNode){
            var checkPerson1= document.getElementById("checkPerson1");
            var treeObj=$.fn.zTree.getZTreeObj("treeDemo1");
            nodes=treeObj.getCheckedNodes(true);

            var  id1="";
            for(var i=0;i<nodes.length;i++){
                if(nodes[i].id!=""){
                    id1+="{'userId':'"+nodes[i].id+"','userName':'"+nodes[i].name+"','deptId':'"+nodes[i].deptId+"','userRole':'"+nodes[i].userRole+"','nextNodeType':'"+nodes[i].nextNodeType+"'};";
                     //alert("pppppp"+id1);
                }
            }
            checkPerson1.value=id1;
        }

    $(document).ready(function(){
        $.fn.zTree.init($("#treeDemo1"), setting1, zNodes1);
    });
 }
function showMenu() {
    var cityObj = $("#citySel");
    var cityOffset = $("#citySel").offset();
    $("#menuContent").css({left:cityOffset.left + "px", top:cityOffset.top + cityObj.outerHeight() + "px"}).slideDown("fast");

//  $("body").bind("mousedown", onBodyDown);
}
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

4条回答

为你推荐

换一换