Responsive datatable expand button action

Responsive datatable expand button action

ACD58ACD58 Posts: 2Questions: 1Answers: 0
edited March 2017 in Free community support

Hello everyone, I have this code which turns the rows of my table into links :

$("table tbody tr").on('click', 'td', function () {
      rdv_selectionne = table[table_actuelle].row(this.parents("tr")).data();
      url = rdv_selectionne[0];
      url = $('<textarea />').html(url).text();

      location.href = url;
   });

When I look at my datatable in responsive mode, and click on the expand button, the link is still working. How can I disable the action of the link on the expand button, but still be able to click on the td to get to the page I linked to?

Answers

  • ACD58ACD58 Posts: 2Questions: 1Answers: 0

    Answer :

    add this to datatable function

    responsive: {
                details: {
                  type: "column"
                }
              },
    "columnDefs": [
                    {"targets": 1, visible: false}, //hidden link
                    {
                        className: 'control',
                        "sorting": false,
                        orderable: false,
                        targets:    0
                    },
    
                ],
                order: [ 5, "desc" ]
    
This discussion has been closed.