Ember.js rendering large lists without locking up the browser

假如想象 提交于 2019-12-07 13:38:35

问题


When it comes to rendering a large list of items on the client-side, what are my options with Ember.js? Pagination comes to mind as an obvious way to decrease the rendering time, but are there any other tricks that allow you to render a big list of items without that noticeable browser freeze as the javascript executes?


回答1:


ember-list-view for lists

ember-table for tables

I tried a million different ways of rendering lists and templates without these to no avail, so hopefully this helps someone.




回答2:


I found a similar performance issue when rendering large lists.

My use cases is to render log entries. I ended up using jQuery and writing directly to the DOM.

Here's a post on how I did it and here's the code.

To cut a long story short, I get 50 records and render them on the screen. At the bottom of the screen, I have a Show More button. If the user clicks this, I append the next 50 of the bottom of the list.

Note that my records are read only. If I had to perform CRUD operations, I would revert to using collections with paging. Collections provide binding support so when the user edits a record, the fields in the list will automatically get updated. Here's the post on CRUD operations.

My code is still using Sproutcore 2 before it was renamed to EmberJS. I think you will find most of the API are the same - just the namespace needs changing.

Hope this helps.



来源:https://stackoverflow.com/questions/8778259/ember-js-rendering-large-lists-without-locking-up-the-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!