I have dataset to be used in a list using Sencha Touch 2.1 in which most items begin with a prefix (E.g. P-, S-, CSV- etc.). Some, however, do not.
The prefix is not relevant for sorting and grouping the list (as the prefix is not what users will be looking for). If all items had prefixes and all prefixes were single letters I would just sort by third letter. As this is not the case I really have no idea how to continue.
Thus I want to set up a conditional grouping and sorting function along the lines of: If {name} contains hyphen: sort/group by first letter after first hyphen, else: sort by first letter
Also, some of the names will be identical without the prefix (e.g P-Albumin, U-Albumin) if the rest of the string is identical I'd want the rows with "Albumin" to be sorted their prefixes. Also, even with prefixes some strings would be the same and another field e.g. "age" would differ so
Code:
{ name: 'P-Albumin', age: '40 - 50' },
{ name: 'P-Albumin', age: '20 - 30' },
{ name: 'CSV-Albumin', age: '30' },
{ name: 'ASAT', age: '30'},
Would be grouped together under the letter A, and sorted so that the row with age equalling 20 - 30 would precede the one equalling 40 - 50, and the row with the prefix CSV- in turn would precede them both and ASAT remaining last.
I appreciate any tips, pointers, help, advice I can get.