PDA

View Full Version : [FIXED] [2.1.0] Dynamically setting List to Grouped fails



welshcathy
12 Nov 2012, 11:46 AM
I have a list which is initially rendered ungrouped on a store with no grouper function defined.

I use the following code to dynamically change this to a grouped list


var store = list.getStore();

store.setGrouper(<grouper function>);
list.setGrouped(true);


This used to work in Touch 2.0.1 but now there's an error in Ext.dataview.List as headerIndices are not defined during the all to list.setGrouped(true);
They are only updated on list.refresh();

Suggested patch to Ext.dataview.List


updateGrouped: function(grouped) {
var me = this,
baseCls = this.getBaseCls(),
cls = baseCls + '-grouped',
unCls = baseCls + '-ungrouped';


if (grouped) {
// START OF PATCH
if (!me.headerIndices){
me.findGroupHeaderIndices();
}
// END OF PATCH
me.addCls(cls);
me.removeCls(unCls);
me.updatePinHeaders(me.getPinHeaders());
}
......




Sorry don't have time to post an example right now .. hope you can work with this...

mitchellsimoens
12 Nov 2012, 4:40 PM
Thanks for the report! I have opened a bug in our bug tracker.

ingo.hefti
13 Nov 2012, 7:14 AM
I just ran into this myself. BTW: the opposite (ungrouping) works:
list.setGrouped(false);

TommyMaintz
15 Nov 2012, 8:17 AM
This problem has been fixed for the next release. In the meantime you can use the following override:



Ext.define('Ext.ListGroupFix', {
override: 'Ext.dataview.List',

updateGrouped: function(grouped) {
var me = this,
baseCls = this.getBaseCls(),
cls = baseCls + '-grouped',
unCls = baseCls + '-ungrouped';

if (grouped) {
me.addCls(cls);
me.removeCls(unCls);
me.updatePinHeaders(me.getPinHeaders());
}
else {
me.addCls(unCls);
me.removeCls(cls);
me.updatePinHeaders(null);
}

me.doRefresh();
}
});


Thanks for the report.