如何使用javascript或jquery将选定的节点从一个树视图复制到另一个树视图? [英] How do I copy selected node from one tree view to other tree view using javascript or jquery ?

查看:63
本文介绍了如何使用javascript或jquery将选定的节点从一个树视图复制到另一个树视图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用javascript或jquery将选定的节点从一个树形视图转换为另一个树形视图?

在我的设计视图中

How do I get selected node from one tree view to other tree view using javascript or jquery ?

in my design view

//head Jquery for check and uncheck 
<script>
 $(document).ready(function () {

            $("div[class $= t1] input[type=checkbox]").click(function () {
                $(this).closest("table").next("div").find("input[type=checkbox]").attr("checked", this.checked);
 });


        });

</script>
//body 
<asp:TreeView ID="treeviwExample" class="t1" ShowCheckBoxes="All"  runat="server" ImageSet="Arrows">
            <HoverNodeStyle Font-Underline="True" ForeColor="#5555DD" />
            <Nodes>
                <asp:TreeNode Text="Root" Value="Root">
                    <asp:TreeNode Text="Parent1" Value="Parent1">
                        <asp:TreeNode Text="Leaf 1" Value="Leaf 1"></asp:TreeNode>
                        <asp:TreeNode Text="Leaf 2" Value="Leaf 2"></asp:TreeNode>
                    </asp:TreeNode>
                    <asp:TreeNode Text="Parent2" Value="Parent2">
                        <asp:TreeNode Text="Leaf 1" Value="Leaf 1"></asp:TreeNode>
                        <asp:TreeNode Text="Leaf 2" Value="Leaf 2"></asp:TreeNode>
                    </asp:TreeNode>
                </asp:TreeNode>
            </Nodes>
            <NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" HorizontalPadding="5px" NodeSpacing="0px" VerticalPadding="0px" />
            <ParentNodeStyle Font-Bold="False" />
            <SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD" HorizontalPadding="0px" VerticalPadding="0px" />            
        </asp:TreeView>

 <asp:TreeView ID="TreeViewSelectedData" runat="server">
    </asp:TreeView>



所以我的疑问是,如果我检查第1个叶子,然后在第2个Treeview中以树格式按以下方式将第1个叶子与父代1和根一起使用



So my doubt is If i check Leaf 1 then i want Leaf 1 along with Parent 1 and Root as below in tree format in 2nd treeview

Root
  Parent 1
     Leaf 1
     Leaf 2


像这样,如果我检查父级2的叶子2,那么我想附加父级2的叶子2


like this if i check leaf 2 of parent 2 then i want to append Parent 2 Leaf 2 like this

Root
  Parent 1
     Leaf 1
     Leaf 2
  Parent 2
     Leaf 1
     Leaf 2



等等.

因此,如果我不选中den,则第二个树视图shud b的元素及其父节点将被删除.

非常非常的意思是我希望在客户端脚本语言上使用它..



and so on .

So if i do uncheck den the elemnt of the 2nd treeview shud b remove along with its parent node.

And very imp is i want this on Client side Scripting language..

推荐答案

( document ).ready (功能(){
(document).ready(function () {


(" div [class
("div[class


= t1] input [type = checkbox]").click(
= t1] input[type=checkbox]").click(function () {


这篇关于如何使用javascript或jquery将选定的节点从一个树视图复制到另一个树视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆