user3464387
user3464387

Reputation: 1

Lookback API not sorting results

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);
},

Upvotes: 0

Views: 102

Answers (1)

Joel Sherriff
Joel Sherriff

Reputation: 478

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.

Upvotes: 2

Related Questions