Rich Select is hanging the browser when we have 10000 option to show

I have a application where I am using the rich select, my requirement is to show some around 10000 data in this.

Options.add({ id:" — “, value:”— "});.

I have function which will populate the data in rich select, when I have less data it is working fine, but when I have more records it is not rendering the data and it is hanging the browser as well.

Can you suggest some solution to this.

Instead of adding records one by one, you need to use

var data = [];
for (...)
   data.push({ id:" --- ", value:"--- "}])

Options.parse(data);

It will add all options at once and repaint rich select only once as well.