How to preselect a radio button in <af:tableSelectOne>? - jsf

We are using Oracle ADF/JSF 1.1 to show search results in a table starting with a radio button. Our requirement is to show search result with one of the <af:tableSelectOne> radio buttons preselected depending on the database value match. However, I am unable to preselect a radio button.
Here is the code snippet:
<f:facet name="selection">
<af:tableSelectOne text="Select" autoSubmit="true" id="radiobtn" />
</f:facet>
How can I preselect it?

I believe that you should change your selection strategy :)
As far as know you can't configure selection property of af:tableSelectOne. It is nested in facet of af:table component, component which drives af:tableSelectOne behaviour. So, in order to select certain row, you should check for property "selectionState" on af:table (I suppose you're using ADF 10.x version)
<af:table value="#{bindings.DemoView1.collectionModel}"
var="row" rows="#{DemoView1.DemoView1.rangeSize}"
first="#{bindings.FilterView1.rangeStart}"
emptyText="#{bindings.DemoView1.viewable ? \'No rows yet.\' : \'Access Denied.\'}"
selectionState="#{bindings.DemoView1.collectionModel.selectedRow}"
selectionListener="#{bindings.DemoView1.collectionModel.makeCurrent}"
id="table1"
I'm sure you'll find it. To get an idea, just drag'n'drop some table object to your jsf page from data control (i.e. view object if you are using ADF Business Components based Data Controls ) and choose table as wanted component, and last step , on that table choose selection option (you should get popup window after drag'n'drop).When you configure your af:table component that way, you can control selection by changing your view object's current row . (View object to which af:table is attached)
Regards

Related

ADF radio button default selection

I have a scenario where I need to apply default selection on one radio button item where radio button list is being populated from a data binding(of static data) and the data control is from a bean class.
<af:selectOneRadio value="#{bindings.si_DmndType.inputValue}"
required="#{bindings.si_DmndType.hints.mandatory}"
shortDesc="#{bindings.si_DmndType.hints.tooltip}" id="sor1"
layout="horizontal" >
<f:selectItems value="#{bindings.si_DmndType.items}" id="si1"/>
<f:validator binding="#{bindings.si_DmndType.validator}"/>
</af:selectOneRadio>
You can set a default value for si_DmndType attribute - in your view object.
For a bean data control, when I have static values for it I need to go at pageDef.xml file -> selecting the variable and updating the DefaultValue attribute of the variable. Basically for a static data source(for bean data control) I need to manually insert DefaultValue which is typically not required when you choose from a Value Object i.e. VO.

JSF getting current state of the check-box

I am working on a JSP project, and I need a functionality that
whenever the check-box is checked, users are REQUIRED to choose an option (from a dropdown menu)
However, whenever the check-box is unchecked, picking an option will not be required.
Right now, my check-box looks like this:
<h:selectBooleanCheckbox class="someClass" value="#{someBean.check}" />
the check is a boolean value in my JAVA class, and my html page should be able to recognize the state of checkbox.
I am wondering how to apply the current state to my dropdown menu, so my dropdown menu will know if user needs to pick one option or not..
Will the use of Ajax listner work in this case?
How to get state of SelectBooleanCheckbox in Ajax Listener?
Or there's any other suggestions?
Thanks a lot!
my previous related question
Conditionally make inputs required depending on checkbox value

upon selection of any selectItems value the related record like address will be displayed

jsf adf....
My code in adf jsf.
this code creates a choice list form the model....and I want that if user selects the perticular customer id from the select list the related address will be displayed in the next line. any idea and solution how to add or bind data control(for address attribute) for such that when the select item vales from the select list generated from the binded model(id attribute only) is selected then the related adrress will get displayed.
<af:selectOneChoice label="#{bindings.InvView1.label}" id="soc1"
binding="#{backingBeanScope.backing_inv.soc1}"
value="#{bindings.InvView1.inputValue}"
required="#{bindings.InvView1.hints.mandatory}">
<f:selectItems value="#{bindings.InvView1.items}" id="si2"
binding="#{backingBeanScope.backing_inv.si2}" />
</af:selectOneChoice>
</af:selectOneChoice>
You can use a bean with a setter (customer ID) that gets activated upton customer selection.
You can use a navigation list.
Like this:
https://blogs.oracle.com/shay/entry/the_navigation_list_select_som

How do you use the Selected property of the navigator?

I've spent days trying to figure this out and I give up.
I am a LotusScript programmer and have been trying to learn XPages. All of the examples and sample programs I've studied only touch on pieces of this.
Can someone explain to me step by step how to use the Selected property of the Extension Library Navigator control?
I have created my own custom control based on the layout control from the Extension Library and created a custom property called navigationPath. I also created a navigator custom control that has 5 Page Link Nodes. In the "Selected" property of each Page Link Node, I put the following SSJS:
if(compositeData.navigationPath == "/Home/ApplicationPool"){
return true
}else{
return false
}
/Home/ApplicationPool corresponds to the value I put in the "Selection" property of the particular Page Link Node.
In each layout custom control, I set the "navigationPath" property to compositeData.navigationPath.
What did I miss?
there is a selected and selection property and they mean very different things and can't be used at the same time. In the code example in your question above you are using the selected property which is the wrong one in this case.
Your treeNodes in the navigator should be setup to use the selection property, this is a RegEx value that is used to see if it matches the value passed into the application layout via the custom property.
<xe:navigator id="navigator1" expandable="true" expandEffect="wipe">
<xe:this.treeNodes>
<xe:pageTreeNode label="nodeName" page="/page.xsp" selection="/Home/ApplicationPool" />
</xe:this.treeNodes>
</xe:navigator>
As you can see you don't need to use any SSJS to evaluate a true/false outcome. Just match the value in the treeNode to the one in the XPage's applicationLayout control.
If your using tabs in the layout titleBar then you can set a selection property there also that uses the format /Home/.* which will make that tab highlighted for every XPage that have /Home/ at the start of it's navigationpath custom property. Don;t forget it is RegEx so any valid RegEx statement can be used here adding more power to this particular property.
For the tree nodes in the navigator control you define the name of the xpage to open and then the related selection. Example:
<xe:pageTreeNode page="/text.xsp" selection="/Home/Test" label="Test page">
</xe:pageTreeNode>
For the individual xpages using the applicationLayout you define a value for navigationPath. If this value matches an entry in one of the tree nodes the naviagor control, then the corresponding menu item will be highlighted in the browser. The best way to define the value of the navigationPath is by using a custom property (as you are using). Here's an example of that:
<xe:applicationLayout id="applicationLayout1">
<xe:this.configuration>
<xe:oneuiApplication navigationPath="${javascript:compositeData.navigationPath}" ...
You can see examples of using all this in the Extension Library Teamroom and Discussion templates.
Based on my explanation on how to use it, I can see that you are not using the selection property on the navigation control correct. You just need to define a unique value for each tree node (which then will be used if it matches navigationPath on the individual xpages).
So for your specific example change your selection property to just return: "/Home/ApplicationPool"

Make editable rows in Datatable

I have list of rows displayed on the screen. These rows are iterated using the JSF datatable component. Now my requirement is to edit any particular row which user clicked.
Is there any way to make the fields editable while user clicking the row. Then user will fill the details and save it.
Any suggestions would be appreciated.
Creating editable data tables is very easy with jsf. Here is a good tutorial on this. But "making it editable when user clicks on it" is not supported out of the box. And this is where JSF shines, you just need to find for a JSF component (open source or commercial) compatible with your JSF (1.x or 2.x) version and start using it.
My first suggestion for you is to check and see if PrimeFaces provides this kind of component. Here is the component you are looking for.

Resources