You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When you get a huge amount of options, the time spent in these methos can reach 30s for 1500 items.
The main trouble is due to
html = html.add( $())
The array of object is destroyed/rebuit on each iteration.
Here's my fix proposal, make only one big add at the end:
Backbone.Form.editors.Select.prototype._arrayToHtml= function(array) {
var html = [];
//Generate HTML
_.each(array, function(option) {
if (_.isObject(option)) {
if (option.group) {
var optgroup = $j("<optgroup>")
.attr("label",option.group)
.html( this._getOptionsHtml(option.options) );
html[html.length] = optgroup[0];
} else {
var val = (option.val || option.val === 0) ? option.val : '';
html[html.length] = $j('<option>').val(val).text(option.label)[0];
}
}
else {
html[html.length] = $j('<option>').text(option)[0];
}
}, this);
return $j().add( html);
};
The text was updated successfully, but these errors were encountered:
glenpike
pushed a commit
to glenpike/backbone-forms
that referenced
this issue
Oct 3, 2016
As per fix, push each rendered element into an array which we
then pass to $.fn.add in one go - more efficient.
Add test to ensure that add only gets called once.
glenpike
pushed a commit
to glenpike/backbone-forms
that referenced
this issue
Oct 3, 2016
As per fix, push each rendered element into an array which we
then pass to $.fn.add in one go - more efficient.
Add test to ensure that add only gets called once.
glenpike
pushed a commit
to glenpike/backbone-forms
that referenced
this issue
Oct 17, 2016
When you get a huge amount of options, the time spent in these methos can reach 30s for 1500 items.
The main trouble is due to
html = html.add( $())
The array of object is destroyed/rebuit on each iteration.
Here's my fix proposal, make only one big add at the end:
The text was updated successfully, but these errors were encountered: