Skip to content Skip to sidebar Skip to footer

How Can I Sort A List By Month In App Maker?

I want to sort a list in App Maker by month, and I don't know how to it. I think that was the way, but is not. @datasource.item.MONTH#sort()

Solution 1:

I am not sure how many ways there are to achieve this but here are two ways:

First one: Go the the model datasource and change the sorting option to reflect the month and then choose by ascending or descending. See the example below. enter image description here

Second one: Select the table widget and the go to the events section in the Property Editor. Click on the onDataLoad event and type the following code:

widget.datasource.items.sort(
  function(a, b) {
    if (a.Month > b.Month) {
      return1;
    } else {
      return-1;
    }
  }
);

See the image below: enter image description here

Whichever way you prefer, is your choice. Hope it helps!

Note: the second option will sort only records withing single page currently loaded to the client.

Post a Comment for "How Can I Sort A List By Month In App Maker?"