Node/Postgres RC3 errors on sort/pagination

Osx 10.15.5
Wappler 3.0.0 RC3
Node and Postgres local, but same on docker

Getting errors on table sorting and pagination
Standard paged query where I select 3 columns from a table

{status: "500", code: "42803",…}
code: "42803"
message: "select count(*) as "Total" from "rig" order by "r_id" desc limit $1 - column "rig.r_id" must appear in the GROUP BY clause or be used in an aggregate function"
stack: "error: select count(*) as "Total" from "rig" order by "r_id" desc limit $1 - column "rig.r_id" must appear in the GROUP BY clause or be used in an aggregate function↵    at Parser.parseErrorMessage (/Users/mattis/Developer/WapplerBeta/node_beta/node_modules/pg-protocol/dist/parser.js:241:15)↵    at Parser.handlePacket (/Users/mattis/Developer/WapplerBeta/node_beta/node_modules/pg-protocol/dist/parser.js:89:29)↵    at Parser.parse (/Users/mattis/Developer/WapplerBeta/node_beta/node_modules/pg-protocol/dist/parser.js:41:38)↵    at Socket.<anonymous> (/Users/mattis/Developer/WapplerBeta/node_beta/node_modules/pg-protocol/dist/index.js:8:42)↵    at Socket.emit (events.js:311:20)↵    at addChunk (_stream_readable.js:294:12)↵    at readableAddChunk (_stream_readable.js:275:11)↵    at Socket.Readable.push (_stream_readable.js:209:10)↵    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)"
status: "500"

What server model are you using?

Using NodeJS
Error is probably returned from postgres

Are problems with the ORM regarding pg and safer to stick with MySQL ?

Removed Wappler and cleaned out the remaining files.
Created a new project using Docker/NodeJS and Mysql

Sorting now works.

Pagination does as before show the wappler pagination list, but only the navigation arrows and they are disabled. No page numbers and not possible to navigate to page 2, 3 etc..

Still get this in the console :

dmxAppConnect.js:7 Formatter getServerConnectPagination in expression [serverconnect1.data.query1.data.getServerConnectPagination(2,1,'...')] doesn't exist for type array

Here is the code created by the paging generator:

Problem here ? : dmx-repeat="serverconnect1.data.query1.data.getServerConnectPagination(2,1,'...')"

<ul class="pagination" dmx-populate="serverconnect1.data.query1.data" dmx-state="query1" dmx-offset="offset" dmx-generator="bs4paging">
			<li class="page-item" dmx-class:disabled="serverconnect1.data.query1.data.page.current == 1" aria-label="First">
				<a href="javascript:void(0)" class="page-link" dmx-on:click="query1.set('offset',serverconnect1.data.query1.data.page.offset.first)"><span aria-hidden="true">&lsaquo;&lsaquo;</span></a>
			</li>
			<li class="page-item" dmx-class:disabled="serverconnect1.data.query1.data.page.current == 1" aria-label="Previous">
				<a href="javascript:void(0)" class="page-link" dmx-on:click="query1.set('offset',serverconnect1.data.query1.data.page.offset.prev)"><span aria-hidden="true">&lsaquo;</span></a>
			</li>
			<li class="page-item" dmx-class:active="title == serverconnect1.data.query1.data.page.current" dmx-class:disabled="!active" dmx-repeat="serverconnect1.data.query1.data.getServerConnectPagination(2,1,'...')">
				<a href="javascript:void(0)" class="page-link" dmx-on:click="query1.set('offset',(page-1)*serverconnect1.data.query1.data.limit)">{{title}}</a>
			</li>
			<li class="page-item" dmx-class:disabled="serverconnect1.data.query1.data.page.current ==  serverconnect1.data.query1.data.page.total" aria-label="Next">
				<a href="javascript:void(0)" class="page-link" dmx-on:click="query1.set('offset',serverconnect1.data.query1.data.page.offset.next)"><span aria-hidden="true">&rsaquo;</span></a>
			</li>
			<li class="page-item" dmx-class:disabled="serverconnect1.data.query1.data.page.current ==  serverconnect1.data.query1.data.page.total" aria-label="Last">
				<a href="javascript:void(0)" class="page-link" dmx-on:click="query1.set('offset',serverconnect1.data.query1.data.page.offset.last)"><span aria-hidden="true">&rsaquo;&rsaquo;</span></a>
			</li>
		</ul>

I forgot to add that the data is returned as paginated, but not able to navigate

  1. {query1: {offset: 0, limit: 25, total: 246,…}}

  2. query1: {offset: 0, limit: 25, total: 246,…}

1. data: [{id: 1, country_code: "ZW", country_name: "Zimbabwe"},…]

  1. 0: {id: 1, country_code: "ZW", country_name: "Zimbabwe"}
  2. 1: {id: 2, country_code: "ZM", country_name: "Zambia"}
  3. 2: {id: 203, country_code: "ZA", country_name: "South Africa"}
  4. 3: {id: 246, country_code: "YE", country_name: "Yemen"}
  5. 4: {id: 120, country_code: "XK", country_name: "Kosovo"}
  6. 5: {id: 190, country_code: "WS", country_name: "Samoa"}
  7. 6: {id: 244, country_code: "WF", country_name: "Wallis and Futuna Islands"}
  8. 7: {id: 238, country_code: "VU", country_name: "Vanuatu"}
  9. 8: {id: 241, country_code: "VN", country_name: "Vietnam"}
  10. 9: {id: 243, country_code: "VI", country_name: "Virgin Islands (U.S.)"}
  11. 10: {id: 242, country_code: "VG", country_name: "Virgin Islands (British)"}
  12. 11: {id: 240, country_code: "VE", country_name: "Venezuela"}
  13. 12: {id: 189, country_code: "VC", country_name: "Saint Vincent and the Grenadines"}
  14. 13: {id: 239, country_code: "VA", country_name: "Vatican City State"}
  15. 14: {id: 237, country_code: "UZ", country_name: "Uzbekistan"}
  16. 15: {id: 236, country_code: "UY", country_name: "Uruguay"}
  17. 16: {id: 234, country_code: "US", country_name: "United States"}
  18. 17: {id: 235, country_code: "UM", country_name: "United States minor outlying islands"}
  19. 18: {id: 230, country_code: "UG", country_name: "Uganda"}
  20. 19: {id: 231, country_code: "UA", country_name: "Ukraine"}
  21. 20: {id: 219, country_code: "TZ", country_name: "Tanzania, United Republic of"}
  22. 21: {id: 144, country_code: "TY", country_name: "Mayotte"}
  23. 22: {id: 217, country_code: "TW", country_name: "Taiwan"}
  24. 23: {id: 229, country_code: "TV", country_name: "Tuvalu"}
  25. 24: {id: 224, country_code: "TT", country_name: "Trinidad and Tobago"}

2. limit: 25
3. offset: 0
4. page: {offset: {first: 0, prev: 0, next: 25, last: 225}, current: 1, total: 10}

  1. current: 1
  2. offset: {first: 0, prev: 0, next: 25, last: 225}

    1. first: 0
    2. last: 225
    3. next: 25
    4. prev: 0

  3. total: 10

5. total: 246
1 Like

Will be fixed in the next update.

If you already want to test, here the updated file. Replace the one in /lib/core.
db.zip (1.2 KB)

Replaced on both my postgres and mysql projects. Still the same error :

Formatter getServerConnectPagination in expression [serverconnect1.data.query1.data.getServerConnectPagination(2,1,'...')] doesn't exist for type array

Ah, didn’t see that error, the fix was for the first error with postgres and sorting on the server.

You need to set serverconnect1.data.query1 as Data Source for the paging generator and not serverconnect1.data.query1.data.

1 Like

Aaaaaw :see_no_evil:, thanks Patrick :wink:

Didn´t notice I had drilled to far down there. Works now