Sorting a database query

For App Connect to sort need to be query values? Or can be direct values. I am trying like this.

Captura de Pantalla 2024-03-08 a la(s) 4.50.29

on code look like this

<dmx-serverconnect id="propList" url="/dmxConnect/api/propList.php" dmx-param:sort="id" dmx-param:dir="'desc'"></dmx-serverconnect>

But on the execution the order is not changed at all.

Captura de Pantalla 2024-03-08 a la(s) 4.49.05

I want to sort on page load.

You need to enter the id and desc as strings. On your screenshot the id is not entered as a string (not typed in the input) but some dynamic value is added. Just type id by hand in the Sort field.

Also, why not just sort in the server action / query?

I have tried in a lot of ways

<dmx-serverconnect id="locationList" url="/dmxConnect/api/admin/locationList.php" dmx-param:sort="'id'" dmx-param:dir="'asc'"></dmx-serverconnect>

The problem on server connect is that in other pages I need a different order.

Prior posting here I have tried like string, as Dynamic, etc, etc and no results

Do you have any sorting set in the database query options?

when the page loads in your browser, do you see the sort and dir params properly sent with the server action call?

Yes but seems to not recognize it

weird

Have you changed the Sort and Direction properties in the server connect / query properties then?

Not at all

Even here in server connect is not recognizing.

Look here direct on server connect still the same.

I create a new server action for testing and still the same. Dont change the order.

Is this happening only when you have a database query with joins? Is this working fine with just one table added?

The testing is only one table

Captura de Pantalla 2024-03-08 a la(s) 5.26.33

You haven’t added any conditions on the sort tab, eg:

image

This I think is when you have conditions. If you want to use the basic ASC and DESC via one field you can use the default ones. Am I right @Teodor??

Captura de Pantalla 2024-03-08 a la(s) 5.26.33

What server model and what database are you using?

PHP for this project.

Wappler 6.3.2 Beta channel

What database are you using?

Mysql local server with Mamp

I just saw this - please add the columns you need here, don’t use * as sorting won’t work if no columns are added to the query builder…

2 Likes