0

I'm attempting to get all defects for a specific portfolio item, in priority order, using the sort config of the SnapshotStore datastore, but its not working. Am I going about this the wrong way?

    getSnapshots : function(record, doneCallback) {
    app.log("getDefectSnapshots"+record.get("ObjectID"));
    var that = this;

    var fetch =   ['ObjectID','FormattedID','_UnformattedID','Name','State','Priority','Severity','_ItemHierarchy','_TypeHierarchy'];
    var hydrate = ['_TypeHierarchy','_ItemHierarchy','State','Priority','Severity', 'Project'];

    var find = {
        '_TypeHierarchy' : { "$in" : ["Defect"]},
        '_ProjectHierarchy' : { "$in": app.currentProject.ObjectID },
        '__At' : 'current',
        "_ItemHierarchy" : { "$in" : record.get("ObjectID")  }
    };

    var storeConfig = {
        autoLoad : true,
        fetch: fetch,
        find : find,
        hydrate: hydrate,
        sort: {'Priority':1},
        limit: 'Infinity',
        listeners : {
            scope : this,
            load: function(store, snapshots, success) {
                app.log("completed snapshots:", snapshots.length);
                doneCallback(null,snapshots);
            }
        },
        pageSize:1000

    };
    var snapshotStore = Ext.create('Rally.data.lookback.SnapshotStore', storeConfig);
},
johnr
  • 98
  • 6

1 Answers1

2

What order are you getting them back in? (I believe) it's sorting Priority by the OIDs value, not the hydrated string value or the ordinal value (order it appears in the dropdowns). The OID order may or may not be the same as the ordinal order though - but that would just be luck. But, it sounds like you're not getting lucky that way.

Joel Sherriff
  • 478
  • 2
  • 6
  • That's correct. Sorting by priority will sort by the OID and not the 'probably' expected sort order. You could try to add the sort to the SnapshotStore ( http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.data.Store-method-sort ) but that will sort lexicographically and still may not be what you want. – Trever Shick Apr 10 '14 at 19:09