gigaZhang / struts2-jquery

Automatically exported from code.google.com/p/struts2-jquery
0 stars 0 forks source link

struts2-jquery-tree-plugin checkbox #908

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
js怎么设置tree节点的checkbox为选中状态?

Original issue reported on code.google.com by anhaiyin...@yahoo.com.cn on 24 Oct 2012 at 4:16

GoogleCodeExporter commented 9 years ago
Please describe this Issue in English.

Original comment by johgep on 24 Oct 2012 at 10:45

GoogleCodeExporter commented 9 years ago
how to set the treenode checkbox is checked or unchecked by js? 

Original comment by anhaiyin...@yahoo.com.cn on 25 Oct 2012 at 12:38

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
jsp:

$("input:checkbox").removeAttr("checked");//I wonder set all checkbox 
unchecked,but failed
$.each( data.itemMenus, function(index, content)
 { 
    $("input:checkbox").each(function(index,value){
        if($(this).val()==content.id)
        {
            //alert($(this).attr("checked"));
            $(this).attr("checked",true);//I wonder set this treenode checkbox checked,but failed

            //alert($(this).attr("checked"));
                                }
    });
 }
);

mytree:
<s:url var="treeDataUrl" action="getAllTreeNodes" />
<sjt:tree 
    jstreetheme="default"
    id="jsonTree" 
    label="menuName"
    name="menuName"
    href="%{treeDataUrl}" 
    checkbox="true">
</sjt:tree>

so,how to do it, thanks!

Original comment by anhaiyin...@yahoo.com.cn on 25 Oct 2012 at 12:54

GoogleCodeExporter commented 9 years ago
how to set the treenode checkbox  checked or unchecked by js?
 
myjsp:

$("input:checkbox").removeAttr("checked");//I wonder set all checkbox 
unchecked,but failed
$.each( data.itemMenus, function(index, content)
 { 
    $("input:checkbox").each(function(index,value){
        if($(this).val()==content.id)
        {
         //alert($(this).attr("checked"));
         $(this).attr("checked",true);//I wonder set this treenode checkbox checked,but failed

         //alert($(this).attr("checked"));
                             }
    });
 }
);

mytree:
<s:url var="treeDataUrl" action="getAllTreeNodes" />
<sjt:tree 
    jstreetheme="default"
    id="jsonTree" 
    label="menuName"
    name="menuName"
    href="%{treeDataUrl}" 
    checkbox="true">
</sjt:tree>

so,how to do it, thanks!

struts2-jquery-tree-plugin-3.4.0.jar

 
 
 
 

--- 12年10月24日,周三, struts2-jquery@googlecode.com 
<struts2-jquery@googlecode.com> 写道:

发件人: struts2-jquery@googlecode.com <struts2-jquery@googlecode.com>
主题: Re: Issue 908 in struts2-jquery: struts2-jquery-tree-plugin checkbox
收件人: anhaiying0126@yahoo.com.cn
日期: 2012年10月24日,周三,下午6:45

Original comment by anhaiyin...@yahoo.com.cn on 29 Oct 2012 at 2:28

GoogleCodeExporter commented 9 years ago
Via JS you can use the jsTree API.

var tree = $('#myTreeId');
tree.jstree("check_node", $('li#myTreeNodeId') );

I work on an built in solution

Original comment by johgep on 22 Nov 2012 at 8:53

GoogleCodeExporter commented 9 years ago
Issue 909 has been merged into this issue.

Original comment by johgep on 22 Nov 2012 at 8:54

GoogleCodeExporter commented 9 years ago
http://code.google.com/p/struts2-jquery/source/detail?r=1759

Original comment by johgep on 22 Nov 2012 at 9:18

GoogleCodeExporter commented 9 years ago

Original comment by johgep on 17 Dec 2012 at 1:20