4

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?

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

ah really cool. I'll have a look at it, maybe I can adapt your work to my problem. Thanks!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.