Remove child rows with no data (empty)
Remove child rows with no data (empty)
toishibekov
Posts: 5Questions: 1Answers: 0
Hi everyone! I have a responsive datatable
I want to remove all child rows with no data. Please help
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
this is my code:
$(document).ready(function() {
$('#example').DataTable( {
responsive: true,
columnDefs: [
{ targets:"_all", orderable: false },
{ targets:[0,1,2,3,4], className: "desktop" },
{ targets:[5], className: "mobile" }
],
pageLength: 5,
lengthChange: false,
"aoColumnDefs": [
{ "bSortable": true, "aTargets": [ "_all" ] }
],
} );
} );
where is the code that produces the detail rows?
the code that produces the detail rows:
The best bet with "I want to remove all child rows with no data" is to not create those rows to begin with. So in that function that creates the child rows, just skip those without data...
How can I skip the data without data. I need the code something like this:
$("span.dtr-data:empty").parent().hide();
<li class="turnir" data-dtr-index="6">
<span class="dtr-title">Expences1:</span>
<span class="dtr-data"></span>
</li>
Thank you, Colin, for the solution. Now It works great
Can you paste the solution here?
Made it myself:
Tnx to @kthorngren here!
Sharing it here for anyone else