Click event was disable when I set the responsiveness to TRUE

Click event was disable when I set the responsiveness to TRUE

lykadoodleslykadoodles Posts: 5Questions: 3Answers: 0

Hi,

I have a clickable field in my table which contains a photo (it pops up a modal upon clicking),but whenever the data table becomes responsive as i minimize the viewport that photo field becomes unclickable. I think the click event has been disabled when the data table becomes responsive.

Question:
What can I do to to retain the clickable field inside my table even when it becomes responsive?
Thanks a lot.

I've set the DataTable responsive to true

$("#myTable").DataTable({ responsive: true });

Answers

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Please link to a test case showing the issue.

    Are you saying that you expect the click event to occur in the child row as well? It is a different node, so you would need to add an event handler for that as well.

    Allan

  • lykadoodleslykadoodles Posts: 5Questions: 3Answers: 0

    Do you have a link or example how to do that? I think I can follow from there. Following a pattern of code

    I tried making a test case from http://live.datatables.net/gijocebo/1/edit but its not being responsive tho i already added the Data Table responsive library

    Thank you so much for the response Allan.

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Just use a standard jQuery event handler:

    $('#myTable').on( 'click', 'tr.child li', function () {
      // do something
    } );
    

    Allan

  • lykadoodleslykadoodles Posts: 5Questions: 3Answers: 0

    Ok that will do. Thanks for the help :)

This discussion has been closed.