3.0 beta 2

UI.Combo & UI.List: Add items to control - performance

See,

function LoadCountries()
{
/* AJAX request */
/* return array of objects */

countries = [{"id":"1", "name": "USA"},"id":"2", "name": "Canada"},..]
for (var i=0;i<countries.length; i++)
{
CountryComboBox.setItemText(countries[i].name, i);
}
CountryComboBox.setItemCount(countries.length);
}

If the number of items is big enough (say, above 1000), this code performs very slowly.

Can I add items to the "UI.Combo" (and "UI.List") any other way?

Thanks


Michael
November 30,
You can rearrange the text into an array and assign the complete array -

var countries = [{"id":"1", "name": "USA"},"id":"2", "name": "Canada"},..];
var names = [];

for (var i=0;i<countries.length; i++){
  names[i] = countries[i].name;
}

CountryComboBox.setItemText(names);
CountryComboBox.setItemCount(names.length);
Alex (ActiveWidgets)
November 30,

This topic is archived.

See also:


Back to support forum

Search

Version 2

Looking for AW 2.6 ?
The old site is here.