Sorting and pagination with Javascript

119 views Asked by At

I use your Javascript binding (@eclipse-ditto/ditto-javascript-client-dom) for HTTP access to Ditto.

load5ThingsAsc() {
    var options = DefaultSearchOptions.getInstance().withLimit(0,5);
    options = options.withSort("+thingId");
    const p = this.searchHandle.search(options).then(result => console.log("returned",result.items))
  }

does fire a:

http://localhost:8080/api/2/search/things?option=limit(0%2C5)%2Csort(%252BthingId)

this results to a Error 400 with the message "Invalid input '%', expected Asc or Desc". A

...
options = options.withSort("-thingId");
...

works fine.

What's my mistake

Thomas

1

There are 1 answers

1
Thomas Jäckle On

This looks like a bug in the JS client. Please feel free to create a GitHub issue in our ditto-clients project for that - or even better: Provide a PullRequest fixing the issue ;)