Skip to Main Content

Java Development Tools

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Defaulting selectonechoice dropdown that is a component of an af:treetable

Roger MarquisJun 2 2022

Hello,
I am seeking a way to default the selectonechoice component's starting choice in a popup.
The use case is that if the dropdown only has 1 choice populated in the list, then the list will default to that choice in the selectonechoice dropdown.
If there is more than 1 choice in the list, then the dropdown should default to a null 'no selection' choice on the list by default.
Additionally, the selectonechoice component in mind is a part of a treetable structure, and I am attempting to get both parent and child selectonechoice dropdowns to default in the structure.
I have made a mockup using the HR schema that somewhat fits the design of the page I am trying to implement this feature on:

Comments

Ruben Rodriguez

Hello,

I have never done this in the model, but you could try to do the same but in the DBResourceBundle.java class call AM method getResourceBundle like this:


getResourceBundle(String locale){

     String amDef = "your.fully.qualified.class.name.of.the.application.module";
     String config = "the_configuration_name_to_use";
     ApplicationModule am = Configuration.createRootApplicationModule(amDef, config);
     Map map = am.getResourceBundle(locale);
     Configuration.releaseApplicationModule(am, false);

          return map;

}

Then, in your entity.xml you should have this reference:

     <ResourceBundle>

         <JavaResourceBundle MsgBundleClass="path.to.DBResourceBundle"/>

      </ResourceBundle>

and in the attribute something like this:

     <Attribute

         Name="AttrName"

         ...>

         <Properties>

           <SchemaBasedProperties>

             <LABEL ResId="LABEL_KEY_IN_DB"/>

           </SchemaBasedProperties>

         </Properties>

      </Attribute>

regards,

Ruben

Ravi4-Oracle

Hi Ruben,

Thanks for the code. Will give it a try.

1 - 2

Post Details

Added on Jun 2 2022
8 comments
71 views