给ztree节点赋值
生活随笔
收集整理的這篇文章主要介紹了
给ztree节点赋值
小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.
需求:點(diǎn)擊節(jié)點(diǎn)的時(shí)候,給節(jié)點(diǎn)賦值,獲取顯示所點(diǎn)擊的樹節(jié)點(diǎn)里面的所有的信息。
圖片.png1:在彈出添加或者刪除界面之前,給節(jié)點(diǎn)賦值,得到節(jié)點(diǎn)里面 的信息之后再做下一步邏輯。
$("#toUpdateBtn").attr("sid", treeNode.id);
$("#deleteBtn").attr("sid", treeNode.id);
在右擊事件里面添加這段代碼‘
// 右擊事件function onRightClick(event, treeId, treeNode) {document.oncontextmenu = function() {return false;}if (treeNode.id == "1") {return;}// 節(jié)點(diǎn)賦值$("#toUpdateBtn").attr("sid", treeNode.id);$("#deleteBtn").attr("sid", treeNode.id);showContextMenu(140, event.clientY - 60);}2:打開編輯節(jié)點(diǎn)的界面的時(shí)候var id = $("#toUpdateBtn").attr("sid");
// 編輯信息$("#toUpdateBtn").on("click", function() {$("#treeContextMenu").hide();var id = $("#toUpdateBtn").attr("sid");layer.open({type : 2,title : '編輯信息',area : [ '1000px', '650px' ],fix : false, // �content : basePath + '/design/detain/toUpd?id='+id,end : function() {initTree();}});});3:刪除節(jié)點(diǎn)信息的時(shí)候,var id = $("#deleteBtn").attr("sid");
$("#deleteBtn").on("click", function() {$("#treeContextMenu").hide();if (!confirm("是否確認(rèn)刪除"))return;var id = $("#deleteBtn").attr("sid");$.ajax({url : basePath + "/design/detain/deleteNode",data : {"id" : id,},type : "get",success : function(data) {initTree();}});deleteDetain(id);});原文作者:祈澈姑娘
原文鏈接:https://www.jianshu.com/u/05f416aefbe1創(chuàng)作不易,轉(zhuǎn)載請(qǐng)告知
90后前端妹子,愛編程,愛運(yùn)營(yíng),愛折騰。堅(jiān)持總結(jié)工作中遇到的技術(shù)問題,堅(jiān)持記錄工作中所所思所見,歡迎大家一起探討交流。
轉(zhuǎn)載于:https://www.cnblogs.com/ting6/p/9725270.html
總結(jié)
以上是生活随笔為你收集整理的给ztree节点赋值的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Maven安装与配置——手把手教程
- 下一篇: 大数据和hadoop的一些基础知识