How can we sort items in Zoho Invoice

How can we sort items in Zoho Invoice

We are trying to write a script which will sort and group the items in Zoho Invoice. However we have performed grouping but we are unable to sort the items. Can anyone help?