You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@click.apache.org by Tim Hooper <th...@gmail.com> on 2011/05/19 16:15:10 UTC

PickList Question

I have a PickList (org.apache.click.extras.control.PickList) with thousands of
items in it.  When using it, it worked fine when adding items from the left to 
right window of the PickList , but would take several minutes to remove even a 
single item (using IE 7 and 9, firefox only took about 6 seconds).

I'm not too good with JavaScript...but...I was able to trace through the 
JavaScript and find the line of code that causes the slowness.  

It's in: /click/extras-control.js 
Function: pickListMoveItem()

The line of code is: to.options[toIndex] = 
  new Option(hidden.options[i].text, hidden.options[i].value);

I don't understand exactly what that line of code is doing.  
However, if I simply comment it out, the problem goes away (ie. it works 
instantly) AND the PickList seems to still work correctly.  

My questions is, what was that line of code doing, and what (if anything) am I 
loosing by commenting it out?

Thanks.

Tim



Re: PickList Question

Posted by Tim Hooper <th...@gmail.com>.
After some more testing, I realized that my code isn't working perfectly without 
that line of code.  It isn't updating the target window of the PickList with a 
newly added item until the user clicks save. 

Tim


Re: PickList Question

Posted by Bob Schellink <sa...@gmail.com>.
On 2011/05/19 16:15 PM, Tim Hooper wrote:
> I have a PickList (org.apache.click.extras.control.PickList) with thousands of
> items in it.  When using it, it worked fine when adding items from the left to
> right window of the PickList , but would take several minutes to remove even a
> single item (using IE 7 and 9, firefox only took about 6 seconds).
>
> I'm not too good with JavaScript...but...I was able to trace through the
> JavaScript and find the line of code that causes the slowness.
>
> It's in: /click/extras-control.js
> Function: pickListMoveItem()
>
> The line of code is: to.options[toIndex] =
>    new Option(hidden.options[i].text, hidden.options[i].value);

As you've found out that line will add the item to the "to" list. Perhaps there is a more effecient 
algorithm for copying items from one list to another?

On the other hand having thousands of items in a select is likely to be a issue with users? Maybe 
you could have a separate screen with some filtering to pick options?

regards

Bob