This is a migrated thread and some comments may be shown as answers.

Adding large amount of items on client side

3 Answers 86 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Lambros
Top achievements
Rank 1
Lambros asked on 27 Jul 2009, 11:06 AM
Hello,

How can i quickly add 5000 items to the list control on client side?

I can use the _addNewItems("", options) in RadComboBox, do you have any similar method in RadListBox control which allows to avoid creating RadListItem javascript objects one by one?

Thanks

3 Answers, 1 is accepted

Sort by
0
Simon
Telerik team
answered on 27 Jul 2009, 12:12 PM
Hi Lambros,

No, RadListBox does not expose such a method.

Have you considered using Ajax and server-side addition of Items? In this way, you would achieve something similar to pure client-side rendering only faster.

Best wishes,
Simon
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
0
Lambros
Top achievements
Rank 1
answered on 27 Jul 2009, 12:50 PM
Hello Simon,

Alas i cannot use the Ajax and server-side addition of Items because due to the project design i cannot use postbacks, i am getting list of items from pagemethod and need to add them on the client side. I am able to modify the contents of the page method return value, but i cannot add items on th server.

Is there any workaround to make client side adding work fast?

Thanks
0
Simon
Telerik team
answered on 27 Jul 2009, 03:20 PM
Hi Lambros,

Well, you could certainly use a workaround. It would take some time to complete the whole operation, yet the browser would not hang until it finishes processing, which I believe is what you are trying to avoid.

So, you could add Items with a timeout, e.g.:

for (var i = 0, i < 5000; i++) { 
    ... 
    window.setTimeout(function() { listBox.get_items().add(...); }, 0); 

Please let me know how it goes.

All the best,
Simon
the Telerik team

Instantly find answers to your questions on the newTelerik Support Portal.
Check out the tipsfor optimizing your support resource searches.
Tags
ListBox
Asked by
Lambros
Top achievements
Rank 1
Answers by
Simon
Telerik team
Lambros
Top achievements
Rank 1
Share this question
or