I want to sort my table view by 2 columns: first by foundset.task_to_call.main_group and then by foundset.task_to_call.sub_group.
How can I do this in the sortfunction?
sort(“task_to_call.main_group asc, task_to_call.sub_group asc”)
Unless I’m not understanding your question…
Code example for a form’s onSort event/command:
/**
* Perform sort.
*
* @param {String} dataProviderID element data provider
* @param {Boolean} asc sort ascending [true] or descending [false]
* @param {JSEvent} event the event that triggered the action
*
* @properties={typeid:24,uuid:"CEC04198-198A-4D7A-8383-505C8D08141E"}
*/
function SORT(dataProviderID, asc, event) {
if (dataProviderID == 'task_to_call.main_group' || dataProviderID ==
'task_to_call.sub_group') {
controller.sort('task_to_call.main_group' + (asc ? ' asc' : ' desc') + '
task_to_call.sub_group' + (asc ? ' asc' : ' desc'), false)
}
else {
controller.sort(dataProviderID + (asc ? ' asc' : ' desc'), false)
}
}
my question is about sorting on the mobile client. There you can only sort using:
foundset.sort(sortFunction)
I was wondering if I can sort using multiple columns using this method.
Stumbled into the mobile forums by accident
in the function that you give you can do anything you want, you only need to return a -1 (smaller ), 0 (equals) , 1 (greater )
of the 2 records that you get in that sort function, see the doc of the sort by function