Hi,
For this page: https://www.idassoc.com/product-information-encyclopedia
Can someone guide me in how to code a container in a repeater row to link to a dynamic item?
- I know this can be accomplished with linking text, but that is performed manually and I can’t do that for all 600 entries in the dataset, it needs to be dynamic.
- I know this can be accomplished with a button, but the buttons don’t wrap text, which makes it difficult to use in a normal table. It looks like this now:
Could someone give me guidance on how to code this or how to make a button text wrap?
Here’s my really bad code:
import wixData from “wix-data”;
import wixLocation from ‘wix-location’;
import {local} from ‘wix-storage’;
export function searchBox_keyPress(event, $w) {
console.log($w(‘#searchBox’).value);
filter($w(‘#searchBox’).value);
let debounceTimer
function update() {
if (debounceTimer) {
clearTimeout(debounceTimer);
debounceTimer = undefined;
}
debounceTimer = setTimeout(() => {
filter($w(‘#searchBox’).value);
}, 100);
}
}
function filter() {
$w(‘#dataset1’).setFilter(
wixData.filter()
.contains(‘article’, $w(‘#searchBox’).value)
.or(
wixData.filter()
.contains(‘acronym’, $w(‘#searchBox’).value)
)
).then(()=> {
if ($w(‘#dataset1’).getTotalCount()===0) {
$w(‘#noResText’).show();
} else {
$w(‘#noResText’).hide()
}
const shortTextLength = 60;
let fullText;
let shortText;
$w(“#repeater”).forEachItem(($w,item) => {
fullText = $w(‘#dataset1’).getCurrentItem().definition;
if (!fullText.length) {
$w(‘#DefinitionText’).collapse();
} else
if (fullText.length <= shortTextLength) {
$w(‘#DefinitionText’).text = fullText;
} **else** {
shortText = fullText.substr(0, shortTextLength) + "...";
$w('#DefinitionText').text = shortText;
}
}
)
}
)
}
$w.onReady( function () {
$w(“#dataset1”).onReady( function () {
const shortTextLength = 60;
let fullText;
let shortText;
$w(“#repeater”).forEachItem(($w,item) => {
fullText = $w(‘#dataset1’).getCurrentItem().definition;
if (!fullText.length) {
$w(‘#DefinitionText’).collapse();
} else
if (fullText.length <= shortTextLength) {
$w(‘#DefinitionText’).text = fullText;
} **else** {
shortText = fullText.substr(0, shortTextLength) + "...";
$w('#DefinitionText').text = shortText;
}
}
)
}
)
}
)
Help appreciated thx!