4

I was trying to make a row of the table I created using Views into something that was clickable. I'm really not finding anything online and everything I try doesn't give me the effect I'm looking for. I'm hoping someone here could share some insights. Thanks.

3

Pardon my neanderthalic jQuery skills here, but if you add a CSS class to your view via the UI, let's all it clickable-row, you could then do something like this in a JavaScript file that basically looks through the HTML and, if it finds a link inside your views row, it makes the surrounding div clickable to that link. So, just as long as one field in your view is a link, you'd be all set.

$('.clickable-row .views-row').each( function() {
  if ($(this).find('a').length) { 
    $(this).click(function() {
        window.location=$(this).find('a').attr('href');
        return false;
    });
  }
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.