Page 1 of 1

Maintaining Sort Order and Resorting a list on the database

Posted: Sat Feb 20, 2016 2:07 pm
by aggregate

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


Maintaining Sort Order and Resorting a list on the database

Posted: Mon Feb 22, 2016 6:35 pm
by Serhii Kulibaba

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.


Maintaining Sort Order and Resorting a list on the database

Posted: Fri Feb 26, 2016 7:42 pm
by aggregate

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.


Maintaining Sort Order and Resorting a list on the database

Posted: Mon Feb 29, 2016 10:46 am
by Serhii Kulibaba

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...