javascript - Ember JS - Improving Performance of Select View -


i have select box contains list of 350-400 <option> element. element data loaded via ajax. loads fine.

but when ember tries create list. browser hangs high ram , cpu uses unresponsive script error shown in browser. given enough time renders.

it seems ember doesn't caches rendered element because every time comeback same page problem repeats.

so, there way can improve performance of view select?

the sample code select view:

{{view "select" prompt="-- select --" content=controllers.application.companies             optionvaluepath="content.id" optionlabelpath="content.name_abbr"             classnames="form-control" value=dailyid}} 

i know 1 of alternatives using typeahead script using text box. want save plan b now.

warning: solution due deprecated of ember 2.0 according this blog entry:

removals

  • ....

  • manually rendering string buffer in view


i don't think have answer you, , didn't come 'cause couldn't find full implementation i've made while back. copy of current select component, except, said, i've implemented render method. this:

app.customselectcomponent = em.component.extend({    tagname: 'select',    optionvaluepath: '',    optionlabelpath: '',    content: [],    render: function(buffer) {     var selfie = this,         options = this.get('content'),         idpath = this.get('optionvaluepath'),         valpath = this.get('optionlabelpath');      options.foreach(function(option) {         buffer.push('<option value=\'' +  option[idpath.replace(/^content\.?/, '')] + '\'>');       buffer.push(option[valpath.replace(/^content\.?/, '')]);       buffer.push('</option>');     });   } }); 

this not implementation had before, , if spend few seconds looking @ see problems solution, however, render implementation might want into.

with implementation is, can better performance already. on jsbin i've added small set of records both ember.select , sample custom-select:

a lil faster built-in ember.select

but again, implementation lacking several features , not enough answer question. did few minutes ago sort of show you'd start implementing render , how, within component.

sorry if isn't answer wanted.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -