Cool, thanks Aaron. I did notice that the properties would not reset when using the template a second time, for example, editing an entry. This is right though because the object is created once and reused. Here is the final snippet I used to compensate for that.
PHP Code:
this.notesTpl = new Ext.XTemplate(
'<tpl for=".">',
'<div class="{[this.getNoteClass(values.noteUser, xindex)]}">',
' <div class="note-author">{noteUser}<br/><span>{noteDatetime}</span></div>',
' <div class="note"><span class="arrow"></span><p>{note}</p></div>',
'</div>',
'</tpl>', {
getNoteClass: function(user, index) {
// Reset properties
if (index == 1) {
this.currentUser = user;
this.currentClass = 'note-wrap';
}
// Determine if new user, toggle class
if (this.currentUser !== user) {
this.currentUser = user;
this.currentClass = this.currentClass.toggle('note-wrap', 'note-wrap-alt');
}
return this.currentClass;
},
currentUser: null,
currentClass: 'note-wrap'
});