In case anybody else wants it. // a version of getSectionIDs that returns the IDs in the order that they are displayed.
// getSectionIDs returns in the order the repeating section lines were created. The user has the ability to reorder the lines.
// getAttrs( [ "_reporder_repeating_" + section_name] , ... ) returns an empty object if the lines were not reordered, and may return an incomplete list.
// This returns a complete list in the order that they are displayed.
var getSectionIDsOrdered = function fnGetSectionIDsOrdered( section_name, callback ) {
'use strict';
getAttrs( [ "_reporder_repeating_" + section_name] , function gaGetSectionIDsOrdered(values) {
'use strict';
if( !values["_reporder_repeating_" + section_name] )
getSectionIDs("repeating_" + section_name, callback ); // There is no ordering, so just call getSectionIDs and tell it to run the callback passed to us.
else
getSectionIDs("repeating_" + section_name, function gsGetSectionIDsOrdered(idarray) {
'use strict';
var ids = _.union( values["_reporder_repeating_" + section_name].toLowerCase().split( ","), idarray);
callback( ids );
});
});
} // end getSectionIDsOrdered()