Show hidden part of 1st row in responsive table using js

Show hidden part of 1st row in responsive table using js

textgaintextgain Posts: 2Questions: 1Answers: 0

I have a responsive datatable. It hides some cells, which is what it is supposed to do. I would now like to be able to show the hidden part of the first row of the table through a button click (so not by clicking on the plus-sign). Not sure how to go about this.

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 21,167Questions: 26Answers: 4,921

    Maybe you can adapt the example in this thread to open the desired row. Something like this:

    var table = $('#example').DataTable();
    $('td', table.row( <place your row selector here> ).node()).eq(0).click();
    

    The row() docs will explain how to pick the row selector for your needs.

    Kevin

  • kthorngrenkthorngren Posts: 21,167Questions: 26Answers: 4,921
    Answer ✓

    Thought about it and realized its not obvious how to select the first row on the page. See this example:
    http://live.datatables.net/homubuye/1/edit

    Kevin

  • textgaintextgain Posts: 2Questions: 1Answers: 0

    $('td', table.row( ':eq(0)' ).node()).eq(0).click();

    This works perfectly. Thanks a million!!!!

This discussion has been closed.