0
I create a table dynamically and that lists Nodes (with 'FATHER' and 'Sons'), I would like that when loading only the first nodes (FATHER) appear and when clicking the children were shown.
The click function would be to show and hide nodes.
JS:
$(document).ready(function () {
CarregaQuantidadeColunas();
function CarregaQuantidadeColunas() {
$('#tblAcao tbody').empty();
$.ajax({
url: "/GED_Diretorio/ListaDiretorios",
data: {},
async: false,
success: function (data) {
if (data.length > 0) {
$.each(data, function (i, element) {
var QtVirgula = element.QuantidadeVirgula;
if (element.TemFilho === "Sim") {
$("#tblAcao > tbody").append(
"<tr>" +
" <td><a href='#'><p style='text-indent: " + QtVirgula + "0px;'> " + element.Codigo + "-" + element.Descricao + "</p></a><td>" +
"</tr>"
);
} else {
$("#tblAcao > tbody").append(
"<tr>" +
" <td><p style='text-indent: " + QtVirgula + "0px;'> " + element.Codigo + "-" + element.Descricao + "</p><td>" +
"</tr>"
);
}
});
} else {
$('#tblAcao tbody').empty();
}
}
});
}
});// fecha $(document).ready JS
HTML:
<table id="tblAcao" class="table table-striped">
<thead>
<tr>
<th></th>
</tr>
</thead>
<tbody>
</tbody>
</table>
Hi @Sam, I want that when Click on 'Shopping' it shows or hides his children, that would be Registration and Archive.
– Danielle Arruda torres