1

EDIT: ANSWER FOUND I found the answer in this post. there is a private store config field called remoteSort that is set to true by default, so client-side sorters won't get used unless remoteSort is explicitly set to false.


I'm trying to sort a grid of Features by the number of User Stories in them. I've tried a couple different things. The first was a sorter function in the data Store Configuration:

    Ext.create('Rally.data.wsapi.Store',{
        model: 'PortfolioItem/Feature',
        autoLoad:true,
        start: 0,
        pageSize: 20,
        fetch: ['Name', 'ObjectID', 'Project', 'Release', 'UserStories','State','_ref'],
        context://context stuff
        filters:[
            //filter stuff
        ],
        sorters:[
            {
                property:'UserStories',
                sorterFn: function(o1, o2){
                    return o1.get('UserStories').Count - o2.get('UserStories').Count;
                }
            }
        ],
        listeners: //listener stuff

But this always returned nothing. (when the sorter was not included, i did get back all the Correct Features, but I could not sort the the number of user stories per Feature).

I also tried adding a sorter to the column in the grid, as seen in this post:

    xtype: 'rallygrid',
        width:'50%',
        height:400,
        scroll:'vertical',
        columnCfgs: [
            {
                text:'Stories', 
                dataIndex:'UserStories', 
                xtype:'numbercolumn',
                sortable:true,
                doSort: function(direction){
                    var ds = this.up('grid').getStore();
                    var field = this.getSortParam();
                    console.log(ds, field, direction);
                    ds.sort({
                        property: field,
                        direction:direction,
                        sorterFn: function(us1, us2){
                            return (direction=='ASC'? 1 : -1) * (us1.get(field).Count - us2.get(field).Count);
                        }
                    });
                },
                width:'20%',
                renderer:function(us){
                    return us.Count; 
                }
            }
        ]

But I was having the same issues that the person in the other thread was having, where nothing was getting sorted.

Community
  • 1
  • 1
spsteffl
  • 413
  • 3
  • 11
  • You might try just using the "LeafStoryCount" property from the Feature model rather than trying to write your own sort method using the collection count property. – Conner Reeves Jul 17 '14 at 20:39

0 Answers0