Database sort in Capacitor SQLite within flow not working

Wappler Version: 6.0.5 Stable
Operating System: Windows 11
Server Model: Capacitor
Database Type: SQLite
Hosting Type:

Expected behavior

When setting a sort in query builder for capacitor sqlite, the resulting records should be sorted.

Actual behavior

Records are not sorted.
image

How to reproduce

Create a database query within an App Flow or Page Flow with a sort.

What version of SQLite is? You can see it on package.json

5.5.0

image

Well, I don’t know if it’s related, but I can see you use the sql.js 1.9.0 which has some troubles.
Maybe you can revert to 1.8.0 which is on the last version of Wappler until (I guess) the sqlite team fix the bug.

Because is an active project, maybe you can try the workaround (I don’t know if 1.8.0 will fix this)

  1. Make a backup
  2. Pin sql.js to 1.8.0 (without the ^)
  3. Run npm install
  4. Copy the wasm file (node_modules/sql.js/dist/sql-wasm.wasm) to the assets folder

Thanks Franse, I tested your solution, but I don’t think that’s the issue. I believe sql.js is only used in combination with jeep-sqlite when attempting to run the app in a browser. I’m running in Electron, so I don’t think it’s used.

Just tested with 1.8.0 and not working on page flow, but the query does:


So I think is related to the flow and not to SQLite

I also tried the data view component and not working:


As a workaround you can use the sort property on the binding panel.

flow1.data.query.sort(`email`)

For some reason, flow1.data.query.sort(`email`).reverse() (for desc) doesn’t work on UI
image

But go to the code and add it:
<tbody is="dmx-repeat" dmx-generator="bs5table" dmx-bind:repeat="flow1.data.query.sort(`email`).reverse()" id="tableRepeat2">

Another workaround:

Converting to “custom” will work :slight_smile:

1 Like

Nice! Glad you were able to confirm. I tried a data view as well and had the same issue. I’ll try a custom query.

Converting to a custom query worked for me! Thanks again for the workaround @franse.

1 Like

Here an update: dmxCapacitorSQLite.zip (10.1 KB)

Thanks @patrick! That resolved sorting.

Fixed in Wappler 6.1.2