Question

I am creating a rallygrid component and would like to have the grid items grouped by their parent's Name attribute (bonus if I could also display the ID of the parent). I added the groupBy:'Parent' configuration to the storeConfig of the grid and was surprised that no results were returned. I also tried using groupBy:'Parent.Name' but still nothing.

I know this is possible with other fields such as Owner, but I'm at a loss as to why the Parent wouldn't be usable as well. Is this a bug, or am I setting the config up incorrectly?

Thanks

Was it helpful?

Solution

Change the storeConfig to keep the records from trying to update after being grouped:

storeConfig : {
    remoteSort   : false,
    remoteGroup  : false,
    remoteFilter : false,
}

Add a listener to the load event which assigns a root level property to the record and groups by that record value. (For some reason store.group('Parent.Name'); doesn't work.)

load: function(store) {
    store.each(function(record) {
        record.set('ParentName', record.get('Parent') && record.get('Parent').Name || '-- Unparented --');
    });

    store.group('ParentName');
}

OTHER TIPS

I thought it was a bug with the SDK too, but per WS API documentation, Parent, unlike Owner, or Feature is not sortable.

So when I use groupField: 'Parent' the grid is empty, and response showed error:

Ext.data.JsonP.callback6({"QueryResult": {..., "Errors": ["Cannot sort using attribute Parent"]

It is trying to sort by Parent, but Parent attribute is not sortable. So the SDK ran into a WS API limitation.

On a side note, I did not use groupBy, instead I used groupField on the store (in this example I grouped by Kanban field) :

var myStore = Ext.create('Rally.data.WsapiDataStore',{
        model: 'UserStory',
        groupField: 'c_MyKB',
        //...
    });

And then used features: [{ftype:'grouping'}] in the grid.

this._myGrid = Ext.create('Ext.grid.Panel', {
        store: myStore,
        features: [{ftype:'grouping'}],
                //...
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top