Results 1 to 2 of 2

Thread: Define a DESC grouper for a store

  1. #1
    Sencha User
    Join Date
    May 2011
    Location
    Belgium
    Posts
    16
    Vote Rating
    0
      0  

    Default Define a DESC grouper for a store

    Hello,
    I try to define a desc grouper for my store like this :
    Code:
    Ext.define('FDM.store.Parts', {
        extend: 'Ext.data.Store',
        model: 'FDM.model.Part',
        ...
        groupers:[{direction:'DESC', property:'type'}],
        ...
    But it doesn't work.
    After looking in the Store.js source file, I understand why.
    In the decodeGroupers function, if the grouper is not "instanceof" Grouper, it overwrite direction with 'ASC'.
    Code:
    decodeGroupers: function(groupers) {
    ...
                if (!(config instanceof Grouper)) {
    ...
                    Ext.applyIf(config, {
                        root     : 'data',
                        direction: "ASC"
                    });
    ...
    Why overwrite the value if this one exist ?

    To solve my problem, I extend the constructor method like this :
    Code:
    constructor: function(config) {
            config = Ext.apply({}, config);
            config.groupers = [new Ext.util.Grouper({direction:'DESC', property:'type'})];
            
            this.callParent([config]);
        }

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,790
    Answers
    583
    Vote Rating
    391
      0  

    Default

    What do you mean by 'it doesn't work'? What happens?

    I don't believe the line you've identified is the cause of your problem. Ext.applyIf() will not overwrite existing properties (unlike Ext.apply(), which will). You should be able to confirm this by putting breakpoints in just before and after that line.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •