« Return to Thread: VWP - dropDown bound to DB question

Re: VWP - dropDown bound to DB question

by Sergei Mutovkin :: Rate this Message:

Reply to Author | View in Thread

On 2/14/07, titan <lawndale99@...> wrote:

>
> Add the extra option in your prerender method, i.e.
>
>         if (dropDown.getSelected() == null) {
>
> // add value to dataprovider
>
> dropDownDataProvider.setCursorRow(dropdownDataProvider.appendRow());
>             dropDownDataProvider.setValue("VALUE", -1);
>             dropDownDataProvider.setValue("DISPLAY_NAME", "Select something
> from list");
>
> // set selected row for the dropdown list
>             dropDown.setSelected(-1);
>         }
>
There are two problems with this approach it seems:
1. Item is added at the very end of the list (not a big issue but
really inconsistent with the rest of the pages on the Internet).
2. If you hit the browser's Refresh button on just loaded page, you
would see your item two times.. click more - more items are added to
the data provider.

I do not yet know how to resolve #1 (I'm just a few days into a whole
JEE stuff), but for #2 it can be easily avoided by adding a property
to the SessionBean which will indicate if it is the first time page is
loaded during the session.

--
Sergei

 « Return to Thread: VWP - dropDown bound to DB question