Native Select Caption

Hi,

 I have just little doubt using NativeSelect control. I have this piece of code...

        myNativeSelect = new NativeSelect();
        myNativeSelect.addContainerProperty("caption", String.class, null);
        myNativeSelect.setItemCaptionMode(NativeSelect.ITEM_CAPTION_MODE_EXPLICIT);
        myNativeSelect.setItemCaptionPropertyId("caption");
        Item wItem = null;
        for (int i = 0; i < myDAO.size(); i++) {
            wItem = myNativeSelect.addItem(myDAO.get(i).getID());
            wItem.getItemProperty("caption").setValue(myDAO.get(i).getName());
        }

After that I have a NativeSelect that display some names and some id for internal control.

On myNativeSelect I have a ValueChangeListener, in other words, every time an user choose a different option in NativeSelect this event is triggered. I can get id of item was selected using this piece of code...

event.getProperty();

But... how can I get Caption of selected item?!

Thanks for any help!!

One way would be to retrieve the item from the nativeselect with the item id you get, and get the property from there. Another solution would be to use the bean (or whatever comes from mydao.get) itself as an item id, and then use that in the listener.