The data table appears to be malfunctioning when the table collapses

Having trouble with the data table when adding a collapse tr. Removing the collapse tr fixes the data table issue. Any help on how to resolve this would be appreciated.

$('.tableToggleUl').parent('td').css('padding','0px');
        $('.tableToggleUl').hide();
        $('.tableToggleBtn').click(function(){
            $(this).parents('tr').next('tr').find('.tableToggleUl').toggle();
            $(this).toggleClass('fa-plus-circle, fa-minus-circle');
        });
        $('.tableToggleBtn').next('.iconConfirmedAppointments, .fa-clock-o, .iconPracticeRescheduled').css('float','left');
        $('.tableToggleBtn').parent('td').css('width','65px');



  $(document).ready(function () {
        $('.btnApptSuggestion').on("click",function(){

            $validator = $('#frmSuggestionAppt').validate();
            $validator.resetForm();

            var AppID=$(this).data('value');
            var patientID=$(this).data('patient');
            var parentId=$(this).data('parentid');
            var AppointmentDate=$(this).data('sugdate');
               
            $('#SuggestionAppointmentID').val(AppID);
            $('#SuggestPatientID').val(patientID);
            $('#SuggestOtherPatientID').val(parentId);
            $('#dateAppointment').val(AppointmentDate);
        });
        try
        {
            var dTable = $('.reportTable').DataTable({
                "paging": true,
                "bSortable": false,
                "lengthChange": true,
                "bRetrieve": true,
                "bProcessing": true,
                "bDestroy": true,
                "searching": true,
                "ordering": false,
                "info": true,
                "autoWidth": true,
                "responsive": true,
                "aLengthMenu": [[20, 30, 50], [20, 30, 50]]
            });
        }
        catch(e)
        {

        }

 });
 <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <link href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css" rel="stylesheet"/>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  
  <div class="container">

<table class="table table-bordered table-hover dr-table datatable reportTable dataTable no-footer" id="DataTables_Table_0">
<thead>
                <tr>
                    <th style="padding-left:36px;" class="sorting_disabled">Status</th>
                    <th style="white-space: nowrap;" class="sorting_disabled">Slot Type</th>
                    <th class="sorting_disabled">Professional</th>
                    <th class="sorting_disabled">Patient</th>
                    <th class="sorting_disabled">Date &amp; time</th>
                    <th class="sorting_disabled">Checked In</th>
                    <th class="sorting_disabled">Checked Out</th>
                    <th class="sorting_disabled">Action</th>
                </tr>
            </thead>
<tbody>
<tr role="row">
                            
                            
                                <td style="width: 65px;"><span class="glyphicon glyphicon-plus tableToggleBtn" style="cursor:pointer;"></span><div class="icon iconConfirmedAppointments" 

style="float: left;"></div></td>
                                                            <td><div class="icon iconPatientWithSlot"></div></td>
                            <td>Dr. Doctor Testing </td>
                            <td>
                                <a href="/doctor/patient_detail?encryptid=vkK6vkgyyNyMuKJi1qDQuw%3D%3D">

                                    Miss. Kratika  Aggrawal Sr.

                                </a>
                            </td>
                                <td>July 19 2017 - 11:00 AM</td>
                            <td>
                                
                                                            </td>
                            <td>
                                
                            </td>
                                <td>
                                        <div class="dropdown">
                                            <a class="dropdown-toggle" data-toggle="dropdown">
                                                <i class="fa fa-pencil fa-lg"></i>
                                                <span class="caret"></span>
                                            </a>
                                            <style>
                                                @media only screen and (min-width:150px) and (max-width:991px) {
                                                    .table .dropdown-menu {
                                                        left: 0px !important;
                                                    }
                                                }
                                            </style>
                                            <ul class="dropdown-menu">
                                                    <li>
                                                        <input type="hidden" value="77" class="Status">
                                                        <input type="hidden" value="8886" class="ID">
                                                        <input type="hidden" class="ParentPatientID">
                                                        <a class="lnkChangeStatus" href="#" style="width:auto;">Appointment Status</a>
                                                    </li>
                                                    <li>
                                                        <input type="hidden" value="8886" class="ID">
                                                        <a href="/doctor/dr_otherappointment?encryptid=vkK6vkgyyNyMuKJi1qDQuw%3D%3D" style="width:auto;">Outgoing Referrals</a>
                                                    </li>


                                            </ul>
                                        </div>
                                </td>


                        </tr>
<tr>
                            <td colspan="8" style="padding: 0px;">
                                <ul class="tableToggleUl">

                                    <li>
                                        <label>Report Status</label>
                                            <span></span>
                                    </li>
                                    <li>
                                        <label>Record Uploaded</label>
                                            <span>No</span>
                                    </li>
                                    <li>
                                        <label>Order Received</label>
                                            <span>No</span>

                                    </li>
                                    <li>
                                        <label>Authorization</label>
                                            <span>No</span>
                                    </li>
                                    <li class="tableRow1Height">
                                        <label>Care Plan Uploaded</label>
                                            <span>No</span>

                                    </li>
                                    <li>
                                        <label>Guardian Name</label>
                                            <span></span>                                    </li>
                                    <li>
                                        <label>Referred By</label>
                                            <span>Miss. Kratika  Aggrawal Sr. (Patient)</span>
                                    </li>
                                    <li>
                                        <label>Insurance</label>
                                            <span></span>
                                    </li>
                                    <li>
                                        <label>Visit Reason</label>
                                        <span>abdominal Pain</span>
                                    </li>

                                   
                                   
                                    
                                    <li>
                                        <label>How Did Hear</label>
                                        <span>Market Place</span>
                                    </li>
                                   
                                    <li>
                                        <label>Location</label>
                                        <span> Tester Rd  Snohomish Washington 98290</span>
                                    </li>
                                </ul>
                            </td>
                        </tr>
</tbody>
</table>
</div>

<script src="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>

Answer №1

$(document).ready(function() {
$(".tableToggleBtn-tr").click(function(){
    $(".tableToggleUl-td").toggle();
  });
  $('.btnApptSuggestion').on("click", function() {

    $validator = $('#frmSuggestionAppt').validate();
    $validator.resetForm();

    var AppID = $(this).data('value');
    var patientID = $(this).data('patient');
    var parentId = $(this).data('parentid');
    var AppointmentDate = $(this).data('sugdate');

    $('#SuggestionAppointmentID').val(AppID);
    $('#SuggestPatientID').val(patientID);
    $('#SuggestOtherPatientID').val(parentId);
    $('#dateAppointment').val(AppointmentDate);
  });
  try {
    var dTable = $('.reportTable').DataTable({
      "paging": true,
      "bSortable": false,
      "lengthChange": true,
      "bRetrieve": true,
      "bProcessing": true,
      "bDestroy": true,
      "searching": true,
      "ordering": false,
      "info": true,
      "autoWidth": true,
      "responsive": true,
      "aLengthMenu": [
        [20, 30, 50],
        [20, 30, 50]
      ]
    });
  } catch (e) {

  }

});
.tableToggleUl-td { display: none;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link href="https://cdn.datatables.net/1.10.15/css/jquery.dataTables.min.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

<div class="container">

  <table class="table table-bordered table-hover dr-table datatable reportTable dataTable no-footer" id="DataTables_Table_0">
    <thead>
      <tr>
        <th style="padding-left:36px;" class="sorting_disabled">Status</th>
        <th style="white-space: nowrap;" class="sorting_disabled">Slot Type</th>
        <th class="sorting_disabled">Professional</th>
        <th class="sorting_disabled">Patient</th>
        <th class="sorting_disabled">Date &amp; time</th>
        <th class="sorting_disabled">Checked In</th>
        <th class="sorting_disabled">Checked Out</th>
        <th class="sorting_disabled">Action</th>
      </tr>
    </thead>
    <tbody>
      <tr role="row" class="tableToggleBtn-tr">

        <td style="width: 65px;"><span class="glyphicon glyphicon-plus tableToggleBtn" style="cursor:pointer;"></span>
          <div class="icon iconConfirmedAppointments" style="float: left;"></div>
        </td>
        <td>
          <div class="icon iconPatientWithSlot"></div>
        </td>
        <td>Dr. Doctor Testing </td>
        <td>
          <a href="/doctor/patient_detail?encryptid=vkK6vkgyyNyMuKJi1qDQuw%3D%3D">

                                    Miss. Kratika  Aggrawal Sr.

                                </a>
        </td>
        <td>July 19 2017 - 11:00 AM</td>
        <td>

        </td>
        <td>

        </td>
        <td>
          <div class="dropdown">
            <a class="dropdown-toggle" data-toggle="dropdown">
              <i class="fa fa-pencil fa-lg"></i>
              <span class="caret"></span>
            </a>
            <style>
              @media only screen and (min-width:150px) and (max-width:991px) {
                .table .dropdown-menu {
                  left: 0px !important;
                }
              }
            </style>
            <ul class="dropdown-menu">
              <li>
                <input type="hidden" value="77" class="Status">
                <input type="hidden" value="8886" class="ID">
                <input type="hidden" class="ParentPatientID">
                <a class="lnkChangeStatus" href="#" style="width:auto;">Appointment Status</a>
              </li>
              <li>
                <input type="hidden" value="8886" class="ID">
                <a href="/doctor/dr_otherappointment?encryptid=vkK6vkgyyNyMuKJi1qDQuw%3D%3D" style="width:auto;">Outgoing Referrals</a>
              </li>


            </ul>
          </div>
        </td>


      </tr>
      <tr>
        <td colspan="8" style="padding: 0px;"  class="tableToggleUl-td">
          <ul class="tableToggleUl">

            <li>
              <label>Report Status</label>
              <span></span>
            </li>
            <li>
              <label>Record Uploaded</label>
              <span>No</span>
            </li>
            <li>
              <label>Order Received</label>
              <span>No</span>

            </li>
            <li>
              <label>Authorization</label>
              <span>No</span>
            </li>
            <li class="tableRow1Height">
              <label>Care Plan Uploaded</label>
              <span>No</span>

            </li>
            <li>
              <label>Guardian Name</label>
              <span></span> </li>
            <li>
              <label>Referred By</label>
              <span>Miss. Kratika  Aggrawal Sr. (Patient)</span>
            </li>
            <li>
              <label>Insurance</label>
              <span></span>
            </li>
            <li>
              <label>Visit Reason</label>
              <span>abdominal Pain</span>
            </li>


            <li>
              <label>How Did Hear</label>
              <span>Market Place</span>
            </li>

            <li>
              <label>Location</label>
              <span> Tester Rd  Snohomish Washington 98290</span>
            </li>
          </ul>
        </td>
      </tr>
    </tbody>
  </table>
</div>

<script enter code heresrc="https://cdn.datatables.net/1.10.15/js/jquery.dataTables.min.js"></script>

let's hope this is effective

Answer №2

When looking at Allan's response on the topic of DataTables and colspan, it becomes clear that Datatable does not currently support the use of colspan. The complexity arises from how sorting and filtering would be affected by columns spanning multiple cells. This raises questions about which column the data should belong to for sorting and filtering purposes.

Your issue may lie in your usage of colspan, as shown here:

<td colspan="8" style="padding: 0px;"  class="tableToggleUl-td">

This could be the reason for the malfunctioning of the datatable on your end.

Although incorporating colspan is currently not feasible, you can explore using Complex headers if you require merged table headers.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Contrast between JQuery .display/.conceal and CSS view:invisible

I'm working on a way to toggle the visibility of a Div element using JQuery: $("#Progress").hide("fast"); But I want the #Progress div to be hidden by default. <div style="height:30px;margin-top:5px"> <div id="Progress" style="visibil ...

PHP is not receiving data from the JQuery Form Plugin

I am currently utilizing the JQuery Form Plugin as an AJAX file uploader. The HTML form in question is being generated dynamically, and it has the following structure: <form id="formUpload" action="fileReceiver.php" method="post" enctype="multipart/fo ...

Here is a guide on how to ensure that the div elements automatically fill the available space

Looking at this html page: Check out the jsFidlle Demo here I am aiming to have the boxes fill up the space effortlessly, each with equal width but varying heights. This is similar to the layout in Google Keep notes ...

The functionality of `config.assets.debug = true` fails to

I've encountered an issue with the configuration on development where config.assets.debug = true doesn't seem to work correctly. Instead of having multiple separate JavaScript and CSS file inclusions, I'm getting a consolidated one: <li ...

A guide on embedding the flag status within the image tag

I would like to determine the status of the image within the img tag using a flag called "imagestatus" in the provided code: echo '<a href="#" class="swap-menu"><img id="menu_image" src="images/collapsed.gif" hspace = "2"/>'.$B-> ...

Error message: Fancybox unable to open PDF file - ReferenceError: href is not defined

I came across some really interesting code on a website detailing how to open a PDF within a Fancybox iframe. However, I am trying to implement this into a CSS Menu that I generated using PHP. When I try to run the code, I receive an error message in the G ...

A division of text is colliding with a division that holds a list with no particular

Hello everyone, I am new to HTML/CSS and I am facing an issue that I believe can be easily resolved. Currently, my code has four sections, with the last three displaying as expected in a consecutive manner. However, the second section is overlapping on t ...

Is there a way to trigger an event once the ajax content has been fully loaded into a div with jQuery?

I have been working on a project that involves creating a scrolling feed content. I have managed to display the feed content inside a div successfully. However, I am facing an issue where each feed item needs to scroll individually. To achieve this, I trie ...

What are the benefits of using Semantic mark-up and WAI-ARIA in a Tabbed Section?

Currently working on the structure of a website and aiming to improve accessibility skills. I'm curious about the most appropriate way to mark up tabbed content. Here's what I have so far: <section> <nav> <a href="#tab" aria ...

Unable to make changes to the text within the textarea field

Currently, I am in the process of creating a script to streamline the tedious task of providing teaching feedback. To scrape data such as student names and classes, I am utilizing selenium/python. While everything is running smoothly, I have encountered an ...

Display exclusively the provided value

Can someone please help me with printing in PDF style and displaying only the inputted value without showing the textbox or dropdown? Check out this image for reference I would like to achieve something similar, how can I do that? Any assistance would be ...

ReactJS Application: Issue with Selective Mobile Scrolling

I've been working on a ReactJS web app where we mainly use styled-components for styling, but also sometimes utilize index.css for global styles (such as body and html). The application consists of an app header, a page header, and a container with a ...

Inserting an item into a list

Looking for assistance with this particular scenario: { "EekvB3cnwEzE":{ "name":"hi", }, "Brv1R4C6bZnD":{ "name":"yup", }, "kRwRXju6ALJZ":{ "name":"okay", } } I'm attempting to store each of these objects in an array. Howe ...

<use> - SVG: Circles with different stroke properties

Why is the stroke of both <use> elements being ignored here? The stroke color of <circle> is set to blue, which is also appearing on both <use> elements. Why? I am trying to set different stroke colors for all three of these elements, bu ...

How to conceal sections of a webpage until a child component is successfully loaded with vue

I am currently working on a Single Page Application using Vue. The default layout consists of some HTML in the header, followed by an abstract child component that is injected into the page. Each child component has a loader to display while the data is be ...

Encountering error callback in AJAX when executing MySQL update query using PHP

As someone who is just starting out with PHP and backend web development, please excuse me if I make any silly mistakes. My current project involves uploading an image using PHP, utilizing jQuery and AJAX to trigger the PHP function, and then storing the ...

How to globally convert Bulgarian short date patterns in jQuery Globalize from date strings to date objects

Is it possible to create a date object from a Bulgarian short date pattern string without removing the 'г.' in it? new Date('26.6.2015 г.') I am trying to compare a selected date from the calendar with today's date. if (($.da ...

When the button is clicked, a modal will pop up

Looking for help in incorporating JavaScript to create a responsive modal that pops up with lyrics when a button is pressed in a table. Any assistance would be greatly appreciated. Note: Only the code for the table has been provided. Let me know if you&ap ...

Struggling with a filtering and sorting problem in my code, looking for some assistance

I'm encountering an issue with an isotope filter menu. The goal is for it to load data based on a timestamp and allow filtering. However, there seems to be a conflict between my sortBy script and the filter script. Below is the code in question: Sor ...

Styling the footer of a webpage using CSS to adapt to different browser

I am currently working on a webpage that includes a footer. The footer is positioned correctly, but I encounter an issue when resizing the browser from bottom to top. For further details, please refer to the image below: Below is the CSS code for my foote ...