1. #1
    Sencha User
    Join Date
    Mar 2013
    Posts
    10
    Answers
    1
    Vote Rating
    0
    amaunz is on a distinguished road

      0  

    Default Answered: Local Sorting in Grid Column: how to fix it

    Answered: Local Sorting in Grid Column: how to fix it


    Hi, I generate my Ext.grid.Panel using Netzke, and I have not learned ExtJS from the bottom up. Here is the problem: I have disabled remote sorting on my grid, and most of my columns now sort numerically, while some sort alphanumerically (i.e. 10<2 for example). But ALL columns contain numerical data only and therefore should sort numerically!

    I am sure this has something to do with how Netzke generates the columns (the affected ones are 'virtual' columns), but I would like to fix that on the client side first. Also, enabling remote sorting is not an option. I have now already waisted a lot of time to find out how to fix the sorters for the affected columns, with no success. Any help would be much appreciated.

    I am using version 4.1.x of ExtJS.

  2. If the data is coming in as a string and you don't have a type on the field in the model then it will think it's just a string. Setting type to 'int' will convert it to an integer allowing the sorting to be numeric.

  3. #2
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Answers
    3462
    Vote Rating
    827
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    Do you have a type set on the model field?
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  4. #3
    Sencha User
    Join Date
    Mar 2013
    Posts
    10
    Answers
    1
    Vote Rating
    0
    amaunz is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    Do you have a type set on the model field?
    Probably that is what Netzke is missing. Could you indicate how to do it? What do I need to do after having set the type?

    Thanks so much!

  5. #4
    Sencha - Senior Forum Manager mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    36,754
    Answers
    3462
    Vote Rating
    827
    mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute mitchellsimoens has a reputation beyond repute

      0  

    Default


    If the data is coming in as a string and you don't have a type on the field in the model then it will think it's just a string. Setting type to 'int' will convert it to an integer allowing the sorting to be numeric.
    Mitchell Simoens @SenchaMitch
    Sencha Inc, Senior Forum Manager
    ________________
    Check out my GitHub, lots of nice things for Ext JS 4 and Sencha Touch 2
    https://github.com/mitchellsimoens

    Think my support is good? Get more personalized support via a support subscription. https://www.sencha.com/store/

    Need more help with your app? Hire Sencha Services services@sencha.com

    Want to learn Sencha Touch 2? Check out Sencha Touch in Action that is in print!

    When posting code, please use BBCode's CODE tags.

  6. #5
    Sencha User
    Join Date
    Mar 2013
    Posts
    10
    Answers
    1
    Vote Rating
    0
    amaunz is on a distinguished road

      0  

    Default


    Quote Originally Posted by mitchellsimoens View Post
    If the data is coming in as a string and you don't have a type on the field in the model then it will think it's just a string. Setting type to 'int' will convert it to an integer allowing the sorting to be numeric.
    What do you mean by 'type'? In my column config object I can set xtype, attrType. I have tried setting both to 'numbercolumn' and 'float'/'int', respectively, but no success. My other options look like this:

    flex: 0.75,
    align: 'center',
    filterable: true,
    sortable: true,
    filter: {
    type: 'numeric',
    active: true,
    },
    xtype: 'numbercolumn',
    attrType: 'int',



    BTW, filtering works numerically! Please help.

  7. #6
    Sencha User
    Join Date
    Mar 2013
    Posts
    10
    Answers
    1
    Vote Rating
    0
    amaunz is on a distinguished road

      0  

    Default


    Ok, I have solved it. Setting attrType to decimal in Netzke does the trick. Thank you!

Thread Participants: 1

Tags for this Thread

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi