Linking a button to an LOV page in ADF UIX

0

Imagine this situation: in an input form you need to be able to pass a value from one of several LOVs to the same text field. Using JHeadstart, it’s easy to generate a messageLovField to which one LOV page is assigned. But you need more than one. How can this be done?

The Oracle ADF UIX Developer’s Guide contains a chapter on LOV pages. Using the info in this chapter, along with the UIX code generated by JHeadstart, I ended up with this next solution for assigning three buttons to three different LOV pages and making sure one inpuit field is updated by all of them.
First of all, in JHeadstart I created three LOVs based on nearly the same query. The only difference between them is the value of one query bind parameter which determines what is contained in the LOV. Next I used the code in the section about the lovOpenWindowAction Client Action in chapter 11 of the ADF UIX Developer’s Guide.
The code, it says there, to use a button to launch an LOV is this

<button text="Some Text">
  <primaryclientaction>
    <lovopenwindowaction destination="SomePage.uix" targets="SomeTarget"/>
  </lovopenwindowaction></primaryclientaction>
</button>

Looking at the code generated for one of my LOVs, I copied over one parameter set to the messageLovInput in the generated UIX page. This parameter is called “destination”. My button tag now looked like this:

<button text="Some Text">
  <primaryclientaction>
    <lovopenwindowaction destination="LovPlnElementLookup.do?searchAttribute=&amp;lovUsage=table&amp;multiSelect=false
      &amp;pageTimeStamp=ignore&amp;rowKeyStr=${ui:cond(rowKeyStr!=null,rowKeyStr,uix.current.rowKeyStr)}
      &amp;rangeIndex=${ui:cond(rangeIndex!=null,rangeIndex,uix.current.tableIndex)}
      &amp;baseUIModel=MyUIModel" targets="SomeTarget"/>
  </lovopenwindowaction></primaryclientaction>
</button>

Please note the four lines starting with the “destination” keyword need to be on one line. Next, modify the targets value to point to the input field you’d like to update and modify the input field to be a messageTextInput and you’re done.
In my case, I also needed to update several other field in my table, depending on the value of the input field. So, I copied over the value of the partialTargets parameter over to the targets parameter in my button tag, and I was done:

<button text="Plan Element" rendered="${!uix.current.MyNumber_readOnly}">
  <primaryclientaction>
  <lovopenwindowaction destination="LovPlnElementLookup.do?searchAttribute=&amp;lovUsage=table&amp;multiSelect=false
    &amp;pageTimeStamp=ignore&amp;rowKeyStr=${ui:cond(rowKeyStr!=null,rowKeyStr,uix.current.rowKeyStr)}
    &amp;rangeIndex=${ui:cond(rangeIndex!=null,rangeIndex,uix.current.tableIndex)}
    &amp;baseUIModel=MyUIModel"
    targets="messageBox hasChanges _uixState ${ui:cond(uix.current.isNewRow,'MyViewObject',
    ui:concat('MyViewObject:MtlEltId:',
    ui:concat(uix.current.tableIndex,ui:concat('MyViewObject:rowKeyStr:',uix.current.tableIndex))))}"/>
  </lovopenwindowaction></primaryclientaction>
</button>

Some remarks: the buttons are all referring to different Struts actions, depending on the LOV they need to bring up. Besides that, I had to put the buttons in the same table column as the field they needed to update, else the connection between them was lost. Since our table only allows updating a row when it is new, I wanted not to show the buttons if the row is readonly. Hence the “rendered” parameter in the button tag. Notice the “!” in the EL expression!
So, here are some screenshots to illustrate the three LOV windows. The first image illustrates the window that pops up when the “Plan Element” button is clicked.
The first LOV screen.
The second image shows the window that pops up when the “Catalogus Element” button is clicked.
The second LOV screen.
The third image shows the window that pops up when the “Nieuw Element” button is clicked.
The second LOV screen.
Finally, here’s an image that shows the availability of the buttons. They only appear in the row where a new element can be added.
Availability of the buttons

Share.

About Author

Comments are closed.