Hi! Im loading data to a repeater from this Query:
function traerPedidos ( ) {
wixData . query ( “Pedidos” )
. include ( ‘producto’ , ‘cliente’ )
. limit ( 3 )
. find ()
. then ( ( results ) => {
console . log ( “Pedidos2.items” , results . items );
pedidos2 = results ;
$w ( ‘#tabla’ ). data = pedidos2 . items ;
let fadeOptions = { “duration” : 500 , “delay” : 0 };
$w ( ‘#loadingTable’ ). hide ();
$w ( ‘#boxTabla’ ). show ( ‘fade’ , fadeOptions );
});
}
Then, when the button “next” is clicked it should show the next items, and when the “prev” is click it should show the previous items:
function pagination ( ) {
//When button next is clicked:
$w ( “#btnNext” ). onClick ( ( event ) => {
pedidos2 . next ()
. then ( function ( results ) {
console . log ( “Lote:” , results . items );
pedidos = results ;
$w ( ‘#tabla’ ). data = pedidos . items ; //Change data of the repeater with the next items.
});
});
$w ( "#btnPrev" ). onClick ( ( event ) => {
pedidos2 . prev ()
. then ( function ( results2 ) {
console . log ( "Lote:" , results2 . items );
pedidos = results2 ;
$w ( '#tabla' ). data = pedidos . items ; //Change data of the repeater with the prev items.
});
});
}
The thing is that it only show one time the next 3 items, but then nothing happens (for “next()” or “prev()”). The repeater stays the same.
Any help for what could be happening?