column.linkPath syntax?

I am trying to set the relation between a table and a Dynamic Page in code. I found the tableColumns[0].linkPath property.
According to doc, it should hold the item page;

let firstColLabel = tableColumns[0].linkPath; // “item_page”

When I console.log the value of the current, existing link thru a dataset icon, I get:
“link- CollectionName -all”

How does that relate to a dynamic page? Or, what is the correct syntax for the linkPath property to a Dynamic page?
Hope I get an answer this time, because I am really stuck here.

Hi Giri,
First of all - the document should have been clearer on this, so sorry about that.
If I remember correctly, it should support any kind of links (as defined here )
In the case of a dynamic page, that should simply be the url path for the page you’re trying to reach.
The easiest way to find this is to look in the collection manager, at the value of the special field

Thanks for your answer, Uval. I looked up the page you gave me, but I will find out by trial and error what the syntax for the dynamic part is:
CollectionName/DynamicPageName /{ID} or
CollectionName/DynamicPageName /(ID) or
CollectionName/DynamicPageName /ID or whatever

(I only do primary keys, nothing else)

Also, I found out that having both a Dataset Icon on the page, connected to the table AND manipulating the dataset in code (filters) leads to unpredictable results, which I can understand. Without the icon, all goes well. But if you then want to change something in the table, many options are (understandably) gone (like setting a link to a dynamic page on a second column). If you then put the dataset icon back in and connect it to the table. your whole layout is gone, it is repopulated with all fields and labels.
Is there any way to keep the icon AND write code on the dataset AND have predictable results?

Appreciate the weekend support, good job!

I know its an old post but if anyone needs to use code for their table (i.e displaying data hooks)

https://www.wix.com/corvid/reference/$w.Table.html#Column

To get link paths to work in tables your code should look something like this.

import wixData from 'wix-data';

$w.onReady(function () {
 const currentColumns = $w("#myTable").columns;
 const calculatedColumns = [{
 "id": "col1",
 "dataPath": "profilePhoto",
 "label": "photo",
 "visible": true,
 "width": 100, 
 "type": "image",
 "linkPath": "link-profile-page-_id"
    }

  ];
  $w("#myTable").columns = calculatedColumns.concat(currentColumns)
 
});

To get the correct link path for the dynamic page, open your collection and copy the “Field Key” for the dynamic page you want to link. A normal URL will work in the case of a website but not for dynamic pages.

Mike