Dynamic tables that link to external URL?

Hi all,

Seeking some help here. I’m creating a table from a dataset, and I’d ideally like the user to be able to click anywhere on each row of the table to go to a designated URL. I.e., not using a URL column in the dataset but rather clicking anywhere on each white rectangle in the picture below (you’ll have to excuse my non-technical language!).

It is similar to the way you are able to click on any row and it takes you to the respective dynamic page of each row, but instead would go to a website.

Hope that makes sense, but any clarification please let me know.

Thanks

Robert

First use $table.columns to assign an invisible link column to the table:
https://www.wix.com/corvid/reference/$w.Table.html#columns

Then use onRowSelect() :

import wixLocation from 'wix-location';
//use $w.onReady, $dataset.onReady() etc....
$w("#myTable").onRowSelect( (event) => {
  let rowData = event.rowData;
  let rowLink = rowData.link;
  wixLocation.to(rowLink);
} );

Thank you J.D. May I ask, where do I input the actual respective links that I want each ‘row’ to point to? Would this be in a column in the dataset?

I assumed you have it as a field in your collection.

@jonatandor35 Ah yes I do - got it, many thanks!

Hi J.D., I am dealing with a similar issue. Can I instead get rowLink somehow from productPageUrl ? I don’t quite understand how I would add the link as a field in the collection as you indicate below.