How do you use the Eumerated or Set types for a column in a drop down

Hello,

I searched the forum and looked in the docs and tutorials for an example. I am sure I missed it. I would like to use the enumerated type values for a column as the choices for a drop down. Can someone suggest a solution that works with creator from the user interface. If that is not supported what is the recommended way to use a provider for this case?

Rinaldo

[388 byte] By [digitalrinaldo] at [2007-11-26 8:48:12]
# 1

Hi,

You can use dropdown's options. For example:

dropDown1DefaultOptions.setOptions(new com.sun.rave.web.ui.model.Option[] {

new com.sun.rave.web.ui.model.Option("choice1", "Choice1"),

new com.sun.rave.web.ui.model.Option("choice1", "Choice2")});

This operator adds 2 items to dropdown. Choice1 and Choice2 are strings to display, while choice1 and choice2 are dropdown id values.

If you have fixed set of options, you can use visual designer - select dropDown1DefaultOptions object in Outline window and edit its options property. In other case, use setOptions() in init() method.

Thanks, Misha

(Creator team)

Mikhail_Matveev at 2007-7-6 22:36:21 > top of Java-index,Development Tools,Java Tools...
# 2

Thanks, is there a way to get the options from the db directly.

I have a Database table with a column defined as enumerated 'open','closed','failed'

I want to have open closed, etc appear as options. I hesitate putting the values in an option object becuase it viloates the rule of define it once.

Rinaldo

digitalrinaldo at 2007-7-6 22:36:21 > top of Java-index,Development Tools,Java Tools...
# 3
Hi Rinaldo,"Bind to data" dropdown popup menu item does all. See, for example, this tutorial, right first section. http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/dat aboundcomponents.htmlThanks, Misha(Creator team)
Mikhail_Matveev at 2007-7-6 22:36:21 > top of Java-index,Development Tools,Java Tools...