Question:
I have a dynamic page bound to my “Extractors” dataset.
In the “Title” column, it has text like:
{Name} is a great app
I want an expression kind of like this:
SUBSTITUTE(title, ‘{Name}’, dynamicDataSet.title)
I cant figure out how to access a property on the current item in the dynamic page’s data set.
Product:
Wix Editor
What are you trying to achieve:
A want to replace tokens in text using a dynamic page’s data item to assist in the replacement.
Maybe you should elaborate more.
- SETUP
- DESCRIPTION
- PICs
- DATABASE-SETUP
SUBSTITUTE → is a function like it looks like?
function SUBSTITUTE(title, name, dynamicTitle) {
console.log(title);
console.log(name);
console.log(dynamicTitle);
}
Working with DYNAMIC-DATASETS/PAGES…
$w.onReady(()=>{
$w('#myDynamicDatasetIDhere').onREady(()=> {
let curItem = $w('#myDynamicDatasetIDhere').getCurrentItem();
console.log('Current-Item: ', curItem);
});
});
You will get as RESULT something like…
/* itemObj:
*
* {
* "_id": "fcec780a-3e37-4b64-8a66-37c552c53f99",
* "_owner": "f6c0f9c3-a62d-7e9f-g58d-943829af244d9",
* "_createdDate": "2017-05-01T17:19:03.823Z",
* "_updatedDate": "2017-05-01T17:19:10.477Z",
* "title": "Dr. ",
* "name": "B",
* "link-dynamic-name": "/myCollection/B"
* }
*/
Once you got the current-Item, decide what to do next → next step!