aggregate
Posts: 0
Joined: Thu Apr 24, 2014 11:37 am

Maintaining Sort Order and Resorting a list on the database

I am trying to maintain the order a list of items should be displayed on the database, then allow the user re-sort \ re-order that list. I have seen libraries that enable this from the front end, however, the update to the database would require updating a list of records, which we cannot do via web service. I am looking at doing this with server code and wanted to know if there are any best practice recommendations or examples for executing this function.

Thanks for your guidance

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Maintaining Sort Order and Resorting a list on the database

Hello,

The best way is sorting data with DB request parameter "sort" (https://devcenter.appery.io/documenta...), and don't update these items each time.

aggregate
Posts: 0
Joined: Thu Apr 24, 2014 11:37 am

Maintaining Sort Order and Resorting a list on the database

Hi,

Thanks for the quick response. The problem isnt sorting the response. Its re-sorting the list

So example:

I have items in a list

  1. car

  2. rail

  3. cab

    I want to reorder the list so that cab always returns first, then car, then rail. I want the user to be able to do this. Typically, I would have to update all the items in the list so that the list reads as:

  4. cab

  5. car

  6. rail

    Then the customer can re-order again and the list will return

  7. Rail

  8. cab

  9. car

    Appreciate your insight into how to best handle this.

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Maintaining Sort Order and Resorting a list on the database

Sure, you can sort items locally. E.g. save service response to the storage variable:
https://devcenter.appery.io/documenta...

sort it:
https://developer.mozilla.org/en/docs...

and use that storage variable in the mapping:
https://devcenter.appery.io/documenta...

Return to “Issues”