[英]How can I sort a list by month in App Maker?
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. 请参见下面的示例。
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: 单击onDataLoad事件,然后键入以下代码:
widget.datasource.items.sort(
function(a, b) {
if (a.Month > b.Month) {
return 1;
} else {
return -1;
}
}
);
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. 注意:第二个选项将仅对当前加载到客户端的具有单个页面的记录进行排序。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.