[SOLVED] wix query descending not working

Hi,

I have this code:

$w . onReady ( function () {

**return**  wixData . query ( "Bookings/Services" ) 
    . descending ( "tagLine" ) 
    . find () 
    . then (( results ) => { 
        $w ( '#courseListing' ). data  =  results . items ; 
        **let**  data  =  results . items ; 
        console . log ( data ) 
    }) 

});

I am attempting to reorder the results alphabetically according to the tagLine property in the dataset.
This does not appear to do anything. What am I missing? I have tried using ascending as well and neither option created any change to the result.

Thanks in advance,

VJ

I just want to say that the list in my services for the site and the database listing are in two different orders. Is the Bookings app really playing fair here?

I’ve sorted out a solution.
I have used a bit of javascript code to do the sort on the way through and now it works as desired.

The reason it wasn’t working is that the fields are marked in the database as not being able to be sorted.

The code I am using now is:

$w . onReady ( function () {
console . log ( “hello” );
wixData . query ( “Bookings/Services” )
. find ()
. then ( ( results ) => {
var data1 = results . items
data1 . sort (( a , b ) => ( a . tagLine > b . tagLine ) ? 1 : - 1 )
$w ( ‘#courseListing’ ). data = data1 ;
console . log ( results );
})

works a treat.