How to make datatable row or cell clickable?

Home Forums Porto Admin – Responsive HTML5 Template How to make datatable row or cell clickable?

  • This topic has 1 reply, 2 voices, and was last updated 5 years ago by Support2. This post has been viewed 7804 times
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10028929
    mjejun
    Participant

    Hi,

    I am using Table Tools, and I would like to make the row clickable by users.

    The table is a filter table and whenever the users retrieve new data, the new rows retrieve from backend are automatically clickable.

    Please advise. Thank you.


    #10028939
    Support2
    Keymaster

    Hello,

    You can do that with some custom code, please follow the steps below:

    1) Use this HTML for each <tr>:

    <tr class="custom-clickable-row" data-href="https://www.google.com/">

    2) Add in (js/custom.js):

    $(document).on('click', '.custom-clickable-row', function(e){
    	var url = $(this).data('href');
    
    	window.location = url;
    });

    3) Add in (css/custom.css):

    .custom-clickable-row {
    	cursor: pointer;
    }

    Please, try that and let us know if you need further assistance.

    Kind Regards,

    Rodrigo.


Viewing 2 posts - 1 through 2 (of 2 total)

This topic is marked as "RESOLVED" and can not rceive new replies.