Created
December 10, 2014 23:34
-
-
Save kristianfreeman/2353cd68c0a0ff17733c to your computer and use it in GitHub Desktop.
implementing dynamic rowHeight per list-view item
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
heightForIndex: function(idx){ | |
var entry = this.get('content').objectAt(idx); | |
if (entry.get('rowHeight')) { | |
return entry.get('rowHeight'); | |
} else { | |
return this.rowHeight; | |
} | |
}, | |
updateRows: Ember.observer('[email protected]', function() { | |
// lodash dep here | |
_.each(this.get('childViews'), function(view) { | |
if (!view.get('isDestroying')) | |
view.set('rowHeight', view.get('content.rowHeight')); | |
}); | |
this._rowHeightDidChange(); | |
}), | |
// ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@imkmf, this is really straightforward. so it looks like you have a
rowHeight
property on your model object itself. does your data come from your remote service? or do you know up front what your record's default value is forrowHeight
?also, i dig the lodash usage ;) seems like you can just use ember's own
this.get('chidlViews').forEach(...)
on that one, though, right? are you getting better performance from lodash?