I have a filter or query that is displayed in a repeater, but I don’t want all the results to be displayed at the same time, I want a button to be pressed to gradually display the repeating items, how can I do that?
… Investigating a little, I understood that with the graphical interface of the editor the functionality that I want can be achieved, however it does it with all the elements of the database … what I want is that it is only the data of the filter or query that I currently have in the repeater.
I think I need a function in the button that allows me to gradually show the repeater elements, but I don’t understand how the repeater works, that is, how it displays its elements on the screen.
Can anybody help me? Please!
Thanks but I still can’t get it, in the dataset there are 50 elements which are shown in the repeater, however I apply several search filters on them to obtain a reduced data set, let’s suppose 9 elements in the repeater, now I want to that those 9 elements can be shown gradually…the functions you mentioned do it but not to the 9 elements if not to all the 50 elements of the dataset, how could I gradually show those 9 elements that I mentioned?
@kikevelasquez22 I think this is one of the method →
(not tested)
#repeater1 - repeater
#button1 button1
#container1 - container in the repeater
let num = 0;
$w("#repeater").onItemReady( ($item, itemData, index) => {
if(index === num) {
$item('#container1').expand();
}
else {
$item('#container1').collapse();
}
});
$w('#button1').onClick((event) => {
num = Number(num) + 1;
});
Thanks, the code didn’t work, but it gave me a similar idea of how the problem could be fixed, and well, all I did was get the query array, i.e. all 9 elements and with the slice function ( start, end), adding 2 to the end of the function each time a button is pressed
Something like this:
var num = 2;
$w('#repeater1').data = await consulta
.find()
.then((res) => {
$w('#button1').onClick((event) => {
num = Number(num) + 2;
});
return res.items.slice(0, num);
});
@kikevelasquez22 The code I gave also worked fine for me !!!