Skip to content

Instantly share code, notes, and snippets.

@joshholt
Created November 18, 2009 20:58
Show Gist options
  • Save joshholt/238245 to your computer and use it in GitHub Desktop.
Save joshholt/238245 to your computer and use it in GitHub Desktop.
rowHeight: 21,
customRowHeight: 32,
useCustomRowHeight: YES,
customRowHeightIndexes: function(){
if(!this.get('useCustomRowHeight')) return null;
var ret = SC.IndexSet.create(), idx, len, nextHeaderIdx = 0;
var content = this.getPath('content.treeItemChildren');
if (content) {
len = content.get('length');
for (var i=0; i < len; i++) {
if (content[i].treeItemChildren.length > 0) {
idx = i;
if (idx === 0) {
ret.add(idx);
}else{
ret.add(nextHeaderIdx);
}
}
nextHeaderIdx = content[i].treeItemChildren.length + 1 + nextHeaderIdx;
}
}
return ret.freeze();
}.property('useCustomRowHeight').cacheable(),
contentIndexRowHeight: function(view, content, index){
var rowHeight = this.get('customRowHeight');
var set = this.get('customRowHeightIndexes');
return (set && set.contains(index)) ? rowHeight : this.get('rowHeight');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment