Search code examples
angulardexie

Dexie - Query table and sort


I have this method that works well:

  getOrders(params): Observable<any> 
  {
    return Observable.fromPromise(this.WebDBService.tbOrder.orderBy('[username+annord+tipord+numord]').reverse().toArray());
  }

it returns all the table data properly sorted.

Now I want to filter the tbOrder by username property but I don't know how to combine query filters with orderBy method...

Can you help me?

Thanks


Solution

  • To apply sorting above a query, use sortBy(). It works like toArray() but sorts the resulting array using the given property.