Support » Plugin: TablePress » Make row Clickable

  • Resolved Mark2201

    (@mark2201)


    Hi,

    I recently started using Tablepress and I think it is a great tool, keep up the good work 🙂

    I have made a table and i want to make a row clickable where it uses the link which I use in the right column.

    This is the site: http://www.forento.be/pensioensparen/

    In the right column there will be links and the whole row should be clickable.

    I have been searching on Google but i have been unable to find a solution for this.

    Many thanks for your help.

    http://wordpress.org/plugins/tablepress/

Viewing 15 replies - 1 through 15 (of 29 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your question.

    This should be possible with some extra JavaScript code, that you could for example add to the end of the page that has the Shortcode:

    <script type="text/javascript">
    jQuery(document).ready(function($){
      $('.tablepress-id-1').on( 'click', 'tr', function() {
        var $a = $(this).find('a').last();
        if ( $a.length )
          window.location = $a.attr('href');
      } );
    });
    </script>

    When someone clicks on the row, this should trigger a link on the last link that is in the row.
    Additionally, you might want to change the mouse cursor for the row hover, by adding this to the “Custom CSS” textarea on the “Plugin Options” screen of TablePress:

    .tablepress-id-1 tr:hover {
        cursor: pointer;
    }

    Regards,
    Tobias

    Hi Tobias,

    Thanks for your quick reply, I have tried to add the code but it unfortunately doesn’t seem to work 🙁

    Do you have any idea what could cause it not to work?

    Thank you.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    it works fine for me on the page that you linked to, above… If I click the first row, it sends me to the URL from the link in that row’s last column.

    Regards,
    Tobias

    Replied too quickly, everything now works!

    Thanks

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    Very nice! Good to hear that this helped! 🙂

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

    Hi Tobias,

    I have just added another Table to another page http://www.forento.be/spaarrekening/

    and add the code you mentioned but for some reason the rows are not clickable, do your maybe know what I am doing wrong?

    Many thanks.

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    you must not forget to adjust the table ID in the JavaScript code and in the CSS code (from 1 to 3 now). Also, you’ll need some links in the table to use the function 🙂

    Regards,
    Tobias

    Thanks for your quick reply.

    How do I enable this in the CSS for multiple tables?

    Mark

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Mark,

    in the CSS, just copy and paste the CSS code that I posted above and also adjust the table ID in the copy.

    Regards,
    Tobias

    Thanks, have a great weekend!

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! 🙂
    Have a great weekend, too!

    Best wishes,
    Tobias

    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

    I’m trying to use this idea with my table, but I want the link to be in an invisible column. I’ve tried monkeying with the visibility css setting, which makes the data invisible, but the column still takes up space. Ideas?

    Thanks,
    Brian

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Brian,

    instead of using the visibility property, you’ll want to use

    display: none;

    The difference between those is exactly that thing with taking up space while being invisible.

    Regards,
    Tobias

    Hi Tobias,

    I am trying to implement this code in my site. However, it is not working. The css is working fine to change the pointer but the javascript code is not working. I have updated the code for the correct table id. I was wondering if you could have a look:

    http://peerlendingserver.com/loans/

    Thanks for any advice,
    John

    Worked perfect. Your support is world class.

    Thanks,
    Brian

Viewing 15 replies - 1 through 15 (of 29 total)
  • The topic ‘Make row Clickable’ is closed to new replies.