Sorting table view
Posted:
Fri Oct 04, 2013 4:58 pm
by jdbruijn
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?
Re: Sorting table view
Posted:
Fri Oct 04, 2013 8:37 pm
by david
sort("task_to_call.main_group asc, task_to_call.sub_group asc")
Unless I'm not understanding your question....
Re: Sorting table view
Posted:
Fri Oct 04, 2013 8:39 pm
by david
Code example for a form's onSort event/command:
- Code: Select all
/**
* 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)
}
}
Re: Sorting table view
Posted:
Mon Oct 07, 2013 9:35 am
by jdbruijn
my question is about sorting on the mobile client. There you can only sort using:
- Code: Select all
foundset.sort(sortFunction)
I was wondering if I can sort using multiple columns using this method.
Re: Sorting table view
Posted:
Mon Oct 07, 2013 11:43 pm
by david
Stumbled into the mobile forums by accident
Re: Sorting table view
Posted:
Wed Nov 27, 2013 5:28 pm
by jcompagner
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