Threaded View

Unanswered: Sort, group list in Sencha Touch 2.1 by first letter after hyphen if present

Unanswered: Sort, group list in Sencha Touch 2.1 by first letter after hyphen if present

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 letterAlso, 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

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.