I have a repeater that when I apply a filter, it show’s gaps in the results. It is almost like that’s where the filtered rows would normally go. The filter is being set in on the dataset in the page. Please advise.
Hey Aaron,
Welcome to the Wix Code forums.
Could you post your code here so we can inspect. It seems as if you are creating “blank” repeater items, instead of skipping an item altogether.
Yisrael
I apologize for the delayed response. Please find my code below. I am simply adding the filter and sort to the dataset and then doing some basic data formatting.
import wixData from “wix-data”;
$w.onReady(function () {
$w("#dataset1").onReady( () => {
//$w("#dataset1").setFilter(wixData.filter().eq("approved", true));
$w("#dataset1").setSort( wixData.sort()
.descending("datePosted")
);
$w("#repeater1").forEachItem( ($w) => {
const originalDate = $w("#text20").text;
const newDate = originalDate.split(' ').splice(0, 4).join(' ');
$w('#text20').text = newDate;
console.log('Time removed from Date/Time Stamp: New Date ' + newDate);
let text = $w("#text14");
text.html = text.html.replace(/<span/g, '<span style="font-family:helvetica;font-size:11pt;color:#959595;"');
text.html = text.html.replace(/<p/g, '<p style="font-family:helvetica;font-size:11pt;color:#959595;line-height:1.6"');
$w("#text14").html= text.html;
//console.log(text.html);
});
});
});
Hi Aaron,
I suspect that there is a problem with the timing for the forEachItem loop through the repeater items. What does your repeater onItemReady() function look like?
I would suggest trying without the forEachItem loop to see what the results look like. This will help isolate the problem.
If you continue to have problems, you can post the URL of your site so I can inspect. Only authorized Wix personnel can get access to your site in the editor.
I did not use the onItemReady() function. What’s weird is that I am no longer seeing the gaps in the repeater. If it happens again, I will try using the onItemReady() function and see if that resolves the issue. I appreciate your time in this matter.