Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9195885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:43:40+00:00 2026-06-17T21:43:40+00:00

I have dataset to be used in a list using Sencha Touch 2.1 in

  • 0

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

{ 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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:43:41+00:00Added an answer on June 17, 2026 at 9:43 pm

    For sorting by names you can create a converted field in the model.

    Ext.define('MyApp.model.MyModel', {
    extend : 'Ext.data.Model',
    config : {
        fields : ['name', 'age', 
            {
            name : 'formattedName',
            type : 'string',
            convert : function(v, record) {
                var unformattedName = record.get('name');
                if (unformattedName.indexOf("-") != -1) {
                    return unformattedName.substring(unformattedName
                            .indexOf("-"));
                } else {
                    return unformattedName;
                }
    
            }
        }]
    }
    });
    

    Now you can set the sort-priority in your store config

    Ext.define('MyApp.store.MyStore', {
    extend : 'Ext.data.Store',
    config : {
        model : "MyApp.model.MyModel",
        sorters: 'formattedName, name, age'
        ...
    }
    });
    

    The store first looks at the formatted name without the prefix, then the complete name including the prefix and finally the age.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some designer generated code that I am using to query a dataset.
I have this data set made using write.zoo for which I used the following
I have a list of values in a SQL Table which are used to
I have a small dataset which has most of its schema defined at design
We have a Dataset with about 40 TableAdapters on it. These are used everywhere
I have DataSet which has 3 columns. Name - insurance comp. name - treatmentDate
I have a DataSet with some DataTables that are linked together with DataRelations (classic
I have a dataset with some 30 records in it. I want to update
I have compared two queries which fetch some fairly large data from a database
I'm trying to utilise the demo here: http://knockoutjs.com/examples/cartEditor.html However, in the dataset used, which

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.