EasyUI Forum
April 29, 2024, 04:10:43 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Combotree without using JSON  (Read 6439 times)
Andy1980
Newbie
*
Posts: 14


View Profile Email
« on: November 04, 2013, 06:54:06 AM »

Hi everybody,

ist there a way to use the combotree with multiple select, without using JSON?

Code:
<select id="cc" class="easyui-combotree" style="width:200px;"
        data-options="url:'myjosnfile',required:true">
</select>

I would like to use this, with some fixed strucutre of <ul><li> inside the HTML, but i can't manage it getting the data out of the UL LI structure.

Thanks.

Update: It got it running that way:
Even the getChecked is working :-)

Code:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jQuery EasyUI</title>
<link rel="stylesheet" type="text/css" href="easyui.css">
<link rel="stylesheet" type="text/css" href="icon.css">
<script type="text/javascript" src="jquery-latest.js"></script>
<script type="text/javascript" src="jquery.easyui.min.js"></script>
    <script>
        $(document).ready(function() {
            $('#cc').combotree('loadData', [{
id: 1,
text: 'Level1',
children: [{
id: 11,
text: 'Level2a',
children: [{
id: 21,
text: 'Level3a'
}, {
id: 22,
text: 'Level3b'
}]
},{
id: 12,
text: 'Level2b'
}]
}]); required: true
        });

    </script>
</head>
<body>
    <span>Select:</span>
    <select id="cc" class="easyui-combotree" style="width:150px;" multiple="true" onlyLeafCheck="true"></select>
<a href="javascript:void(0)" onclick="getChecked()">GetChecked</a>
<script>
function getChecked(){
var nodes = $('#cc').combotree('tree');
var mytree = nodes.tree('getChecked');
        var s = '';
var s = '';
for(var i=0; i<mytree.length; i++){
if (s != '') s += ',';
s += mytree[i].text;
s += mytree[i].id;
}
alert(s);
}

</script>
</body>
</html>
« Last Edit: November 04, 2013, 08:30:59 AM by Andy1980 » Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!