I am displaying dynamic events content. But onReady I want to truncate the event descriptions and display the modified events list. Though I managed to slice the content, the repeater is not showing the new array, it still shows the data directly from the database, which indicates my new modified data array is not getting attached to the repeater or I am wrong with my onReady. Can somebody help me here a bit, please?
$w.onReady(function () {
$w("#dynamicDataset").onReady(function (){
let totalCount = $w("#dynamicDataset").getTotalCount()
$w("#dynamicDataset").getItems(0, totalCount)
.then( (results) => {
for(let i=0; i<results.items.length; i++){
if(results.items[i].eventDescription.length > 50)
results.items[i].eventDescription = results.items[i].eventDescription.slice(0, 100) ;
}
let resultsWithSnippet = results.items;
console.log(resultsWithSnippet) // this shows the array with sliced description
$w('#repeater1').data = resultsWithSnippet; //this is not working
})
.catch((err) => {
let errorMsg = err;
})
})
Also, which is a better idea? While saving the data to the database, create snippet field and save the snippet or while displaying in the dynamic page, modify the array and display it.