码迷,mamicode.com
首页 > Web开发 > 详细

jquery,ztree,anglarjs使用(一)

时间:2018-07-10 20:11:56      阅读:218      评论:0      收藏:0      [点我收藏+]

标签:src   order   show   enable   javascrip   bsp   ble   app   open   

html---------

<span class="filterDIV_sp ">名称:</span>
<div class="filter_inp">
<div class="filter_select_t">
<span >{{queryGalleryTxt}}</span>
 
<div class="filter_i">
<i class="i_orderd" style="margin-top: 10px;"></i>
</div>
</div>
<ul id="queryGallery" class="ztree"></ul>
</div>
js--------------------
<script src="/angular1.2.28.min.js"></script>
<script src="r/angular-cookies1.2.28.js"></script>
<script type="text/javascript" src="/jquery-1.10.1.min.js"></script>
<script src="/jquery.ztree.all.min.js"></script>
-------------------------------
$scope.queryGalleryTxt = "不限";
HikGlobalHTTPService.requestByPost("/Tree",{n:2},function(data,status){
if(status){
var queryGallery = [];
recursio(data.result);
function recursio(obj){
obj.name = obj.label;
obj.pid = obj.id;
if(obj.children){
if(obj.children.length > 0){
obj.children = obj.children;
obj.open = true;
obj.nocheck = false;
for(var j = 0; j < obj.children.length; j++){
recursio(obj.children[j]);//递归
}
}
}
}
queryGallery.push(data.result);
sttingQueryGallery = {
check: {
enable: true,
chkStyle: "checkbox",
nocheck:false,
chkboxType : { "Y": "", "N": "" }//父子节点关联
},
 
callback: {
onCheck: function(event, treeId, treeNode){
var zTreeArr = zTreeQueryGallery.getCheckedNodes();
var galleryStr = "";
var galleryIdStr = "";
if(zTreeArr.length > 0){
for(var i = 0; i < zTreeArr.length; i++){
if(i < zTreeArr.length - 1){
galleryStr += zTreeArr[i].name + " , ";
galleryIdStr += zTreeArr[i].pid + ",";
}else{
galleryStr += zTreeArr[i].name;
galleryIdStr += zTreeArr[i].pid;
}
}
$scope.queryaisle = galleryIdStr;
$scope.queryGalleryTxt = galleryStr;
}else{
$scope.queryGalleryTxt = "不限";
$scope.queryaisle = "";
}
$scope.$apply();
}
}
}
zTreeQueryGallery = $.fn.zTree.init($("#queryGallery"),sttingQueryGallery,queryGallery)
}
})
$(".queryGalleryClick").click(function(event){
event.stopPropagation();
$("#queryGallery").show();
$(‘.screen_box‘).css("overflow","visible")

})
$("#queryGallery").click(function(event){
event.stopPropagation();
})
$(document).click(function(){
$("#queryGallery").hide();
})

jquery,ztree,anglarjs使用(一)

标签:src   order   show   enable   javascrip   bsp   ble   app   open   

原文地址:https://www.cnblogs.com/loveAline/p/9290993.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!