Mostar Imagen al seleccionar un nodo del treeview
Publicado por Ruben Dario (2 intervenciones) el 25/11/2014 17:01:01
Buenas Tardes
Necesito mostrar un listado de articulos cuando selecciono un nodo de mi arbol como lo puedo hacer ? este es mi codigo:
Necesito mostrar un listado de articulos cuando selecciono un nodo de mi arbol como lo puedo hacer ? este es mi codigo:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
<?php
function __autoload($class_name)
{
require_once $class_name.'.php';
}
$tree = new Tree();
$elements = $tree->get();
$masters = $elements["masters"];
$childrens = $elements["childrens"];
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/js/bootstrap.min.js"></script>
<style type="text/css">
ul{
list-style: none;
}
</style>
<script>
$(document).ready(function()
{
$(".btn-folder").on("click", function(e)
{
e.preventDefault();
if($(this).attr("data-status") === "1")
{
$(this).attr("data-status", "0");
$(this).find("span").removeClass("glyphicon-minus-sign").addClass("glyphicon-plus-sign")
}
else
{
$(this).attr("data-status", "1");
$(this).find("span").removeClass("glyphicon-plus-sign").addClass("glyphicon-minus-sign")
}
$(this).next("ul").slideToggle();
})
});
</script>
</head>
<body>
<div class="container">
<div class="row">
<div class="col-md-3" id="nested" style="background: #222; color: #ddd">
<h3 class="heading text-center">Mover Archivos Madrid Papel</h3><hr>
<ul>
<?php
foreach($masters as $master)
{
?>
<li style="margin: 2px 0px">
<span><i class='glyphicon glyphicon-folder-open'></i></span>
<a href="#" data-status="<?php echo $master["have_childrens"] ?>"
style="margin: 5px 6px" class="btn btn-warning btn-xs btn-folder">
<span class='<?php echo $master['have_childrens'] == 1 ?
'glyphicon glyphicon-minus-sign' :
'glyphicon glyphicon-plus-sign' ?>'
</span>
<?php echo $master["produc_kind_name"] ?></a>
<?php echo Tree::nested($childrens, $master["id"]) ?>
</li>
<?php
}
?>
</ul>
</div>
</div>
</div>
</body>
</html>
Valora esta pregunta
0