PDA

View Full Version : ListView Striping



dorgan
28 Jul 2010, 9:53 AM
This currently works, with 1 bug...some of the customization is specific to my needs but hopefully someone can solve the bug.

The bug occurs when a column is resized...right now the addStriping method will not get called until you move the mouse after resizing the column....So if you resize the column and do not move the mouse the addStriping method is never called.



Ext.ns('Ext.ux.StatView');
Ext.ux.StatView = Ext.extend(Ext.list.ListView, {
frame: true,
overClass: 'listOver',
height: 273,
autoScroll: true,
reserveScrollOffset: false,
stateful: false,
oddCls: 'rowOdd',
evenCls: 'rowEven',
emptyText: 'No data available for this period',
deferEmptyText: true,
initComponent: function() {
this.on('afterrender', this.addListeners );
Ext.ux.StatView.superclass.initComponent.apply(this, arguments);
},
addListeners: function() {
this.getStore().on('load', function() {
this.addStriping();
}, this);

this.getStore().on('datachanged', function() {
this.addStriping();
}, this);
this.innerHd.on('mousemove', function() {
this.addStriping();
}, this);
this.getStore().load();
},
addStriping: function() {
this.innerBody.select("dl:odd").addClass(this.oddCls);
this.innerBody.select("dl:even").addClass(this.evenCls);
}
});

Ext.reg('statview', Ext.ux.StatView);