开发者

jQuery Checkbox tree selected

开发者 https://www.devze.com 2023-04-10 02:13 出处:网络
I have a checkbox tree using jQuery. Here\'s the code for tree_data.json : [{ \"id\":1, \"text\":\"Administrator\",

I have a checkbox tree using jQuery. Here's the code for tree_data.json :

[{
"id":1,
"text":"Administrator",
"children":[{
    "id":2,
    "text":"Cpanel",
    "state":"open",
    "children":[{
        "id":3,
        "text":"Activator",
        "state":"closed",
            "children":[{
                "text":"Delete"
                },{
                "text":"Edit"
                },{
                "text":"New"
                },{
                "text":"View"
                       }]
              }]
      }]
   }]

and for the view is like this

<table border="1" width="500"><tr><td>
<ul id="tt" class="easyui-tree" url="data/tree_data.json" checkbox="true">
</ul>
</td></tr>
<tr><td>Your selected role are : </td></tr>
</table>
<table><tr><td>Your selected role are <input type="text" /></td></tr></table>

the output for my view is like this:

[]Administrator
  []Cpanel
    []Activator
      []Delete
      []Edit
      []New
      []View

I want to ask how to get my checkbox value.

Example : if开发者_如何学编程 I checked "Delete" and "Edit" then

Your selected role are : "Activator_Delete","Activator_Edit"

Thanks for helping

EDIT:

I'm new to use jQuery, so please help me with giving me some example, not link

Thanks


Use the getChecked method of the easyui tree:

var nodes = $('#tt').tree('getChecked'); 

Here's the .tree method list.

0

精彩评论

暂无评论...
验证码 换一张
取 消