Hi everyone,
I’m using Wappler / App Connect with a Server Connect that returns an object (form_json) from an API.
I’m looping through this object using dmx-repeat with $key and $value, like this:
<tr dmx-repeat:itens_list="get_anuncio.data.produto.form_json">
<td>{{ $key }}</td>
<td>{{ $value }}</td>
</tr>
Everything works fine, but the problem is that the fields are displayed in a random order, since form_json is an object.
What I’m trying to do is:
- Display the object fields in a table
- Sort the fields alphabetically by key
- Keep using App Connect / Server Connect (no backend changes if possible)
I tried:
- toArray() + sort() inside dmx-repeat
- Custom JavaScript with dmx.parse() and the updated event
- Waiting for the Server Connect to finish loading
But I couldn’t get a reliable solution working, probably due to timing/rendering issues.
What is the recommended way in Wappler to sort an object (key/value) alphabetically before rendering it with dmx-repeat?
Any help or best practice would be appreciated.
Thanks in advance!
Site Reference:
