Reputation: 14726
I'm using EmberJS and Handlebars inside my app for displaying a lot of content. Inside the controller, there is an array stream
which holds the data. Based on that stream
array, specific templates are choosen to display the single entries in the right way.
Now I have different types of orders in which the entries should be displayed (e.g. order by time, by user...). Inside the order function, I have to do some calculation based on the properties of the entries. When I change the order, I call this.("stream").clear()
to clear the array, and fill it with the old entries in a new order. Ember detects the changes and causes a re-render of the Handlebar templates.
The problem is, that for about 1s (or even longer when there are more entries in the list), the page is blank, and then the entries in the new order appears. So I was wondering, if it's possible to re-use the rendered views (the content doesn't change) and make this process more faster.
Is there a way to tell Ember, to keep rendered views inside a cache or something? And then to re-use them when inserting into the DOM?
Upvotes: 4
Views: 348
Reputation: 4407
View reuse is something we've been working on. I have a branch with some work on a ListView which abstracts the reuse nicely.
It lives in this branch: https://github.com/ebryn/ember.js/tree/list-view
The files of interest are:
If you're looking for a table, Addepar has released ember-table.
Upvotes: 3