My current situation requires me to organize a list based on two values in ascending order.
First, it should be sorted by SCHEDSTART if available. If SCHEDSTART is blank, then it should be sorted by WONUM.
The div containing SCHEDSTART should always appear first.
I attempted to write some code to achieve this, but unfortunately, it's not functioning as expected:
Here is the code snippet I wrote:
Code 1:
<ion-item ng-repeat="wo in vm.workOrders | orderBy : dynamicOrder">
Controller:
function dynamicOrder(wo){
if(wo.json.SCHEDSTART){
return wo.json.SCHEDSTART;
}else{
return wo.json.WONUM;
}
}
Code 2:
<ion-item ng-repeat="wo in vm.workOrders | orderBy : ['json.SCHEDSTART','json.WONUM']">