Hi,
I was able to specify the length of display text in a repeater, but when I paginate, it loses the restriction. How can I keep the ability to restrict the DefinitionText in the repeater when navigating through the pagination? Page: https://www.idassoc.com/product-information-encyclopedia
![](https://static.wixstatic.com/media/a27d24_1cace73e729641dab4d940e2f2a6d874~mv2.png/v1/fill/w_980,h_688,al_c,q_90,usm_0.66_1.00_0.01,enc_auto/a27d24_1cace73e729641dab4d940e2f2a6d874~mv2.png)
Here is the code I used, can someone let me know what needs to be cleaned up or what I am missing? thx!
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; } } ) } ) } )
Hello guys,
@Heath H-M (Wix Code Extracts) Your code works great! But for some reason the last item in the repeater ignores the code.. I really can't wrap my head around it. Any idea why it does that?
Thanks in advance!
I used a work around instead bc coding seems to really make the site slow. Also decided to eventually pull this project off of WIX bc the code libraries are bloated and cause page performance issues.
The work around was to pull the 1st 50 characters from the description (excel formula) and import a new property in data set called shortDefinition and just map to that. It's cumbersome bc if i decided I want more or less chAracters to show, I have to reimport instead of just changing a number in code.
looks hard bro....following
Hello
I saw your site and it is ok on my computer, did you find the solution?