oasp-forge / oasp4js-rev

The Open Application Standard Platform for JavaScript
http://oasp.github.io/
0 stars 2 forks source link

Implement server-side sorting #30

Closed maybeec closed 8 years ago

maybeec commented 8 years ago

Currently sorting e.g. in the list of tables is done on the current page's elements. However, sorting should be done on every data available and thus server side.

RobertoGM commented 8 years ago

Well, this days I have been focused in this issue and done the following actions:

  1. Modified Grid component to return the column name and direction to sort.
  2. Use that information to add an attribute "sort" to all search requests.

This was enough to do a server side sorting in Tables tab. But with Details and Kitchen I had to modify some files in the oasp-server :

  1. I added two more fields to search for orderPositions in orderPositionDaoImpl because it did not search for offerName, mealName or SideDishName.
  2. I have to add an orderPositionSearchCriteria parameter in findOrderPositionsByOrderId (and all it's subsequent functions until findOrderPositionsByOrder) when searching orderPositions from a single Order because the final data are orderPositions and that is what I want to sort in Details modal.
  3. Added a function addOrderBy similar to the Tables search but with the orderPosition fields.

Once this was done, Details modal could do server-side sorting on all it's columns. Finally, Kitchen tab had another issue to solve, the search call is a GET not a POST, so I had to compose the sorting data in the URL and process that in the function that captures this call. So:

  1. Compose the List object with the name and direction data in the URL.
  2. Since the data in Kitchen tab comes from 3 different tables (orderPosition, order and offer) I had to modify OrderPositionEntity to have access to offer instead of only offerName and offerId.
  3. Added Kitchen column fields to the already made addOrderBy function.

With all this finished I have fully implemented server side sorting on every table of the restaurant app. I will revise the code and then I will do a pull request to the server.