Hi Anthony thanks for your support I guess I owe you a mulled wine.
I checked your hook option, but meanwhile I found a easy solution to my problem. (this was missing on my first code: Array . from ( results.items . reduceRight (( m , t ) => m . set ( t.location , t ), new Map ()). values ()). reverse ()
The final code looks like that:
import wixUsers from ‘wix-users’ ;
import wixData from ‘wix-data’ ;
$w . onReady ( function () {
$w ( ‘#PunkteKonto’ ). onReady (() => {
**let** user = wixUsers.currentUser ;
**let** userId = user.id ;
**let** itemUser = $w ( '#PrivateMember' ). getCurrentItem (). _id ;
**if** ( userId === itemUser ) {
$w ( "#listRepeater" ). onItemReady (( $item , itemData , index ) => {
$item ( "#location" ). text = itemData.location ;
$item ( "#Level" ). text = itemData.level ;
$item ( "#Punkte" ). text = itemData.punkte ;
$item ( "#image" ). src = itemData.Image ;
});
wixData . query ( 'PunkteKonto' )
. eq ( "copyOwner" , userId )
. find ()
. then (( results ) => {
**if** ( results.totalCount > 0 ) {
$w ( '#listRepeater' ). data = Array . **from** ( results.items . reduceRight (( m , t ) => m . **set** ( t.location , t ), **new** Map ()). values ()). reverse (); //This is the missing part!!
}
})
. **catch** (( error ) => {
console . error ( error );
});
});