Fastest way to copy <SELECT>

G

g_meney

Hello,

I am using a web page to update rows in a database. Drawing the full
select for each field for each row can create a very, very large page
to download. Instead i was looking into to drawing a blank <SELECT> for
each field in each row, then fill them from a template at runtime.

Whats the fastest way to copy the options in a select from one select
to another? I am currently populating the options using an array of
data and id values and creating a new Option object :-

<snippet>
var fnOpt = pSelect.options;
n = pArrIDs.length
for(var i=0;i<n;i++)
{
fnOpt[pSelect.length] = new Option(pArrVals, pArrIDs,
false,false);
}
</snippet>

This can take 60+ seconds for 1000 selects (5 per row, 200 rows).

I know that I may need to reduce the number of rows to give it an
acceptable performance, but i was wondering what my options (pardon the
pun) were in populating the <SELECT>. I was looking at :-
* referencing the source options array
* copying the source options array
* cloning the source options array elements

None of these yielded any success so far.

Any help is greatly appreciated.

Thanks,
Gareth.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top