I have view link that I have dragged it as ADF tree table in .jsff page.
<af:treeTable value="#{bindings.SisaiEndPointView1.treeModel}" var="node"
rowSelection="single" id="TT1" contentDelivery="immediate"
columnStretching="last" partialTriggers=":::commandButton1"
editingMode="clickToEdit"
contextMenuSelect="true">
<f:facet name="nodeStamp">
<af:column id="column1" headerText="Ministry" sortable="true"
width="200%">
<af:outputText value="#{node.Ministry}" id="outputText1"/>
</af:column>
</f:facet>
<af:column id="column5" headerText="#Errors" width="100%">
<af:commandLink text="#{node.ErrorMsgCount}" id="cl2" immediate="true" partialSubmit="true" action="#{pageFlowScope.EndPointBean.testInput}">
<af:setActionListener from="test #{node.ErrorMsgCount}"
to="#{pageFlowScope.Min}"/>
</af:commandLink>
</af:column>
public String testInput() {
String str = (String)ADFContext.getCurrent().getPageFlowScope().get("Min");
System.out.println(str);
return null;
}
I am not getting any value when I am printing in action method STR.
It is comming only hardcoded value "test " but not getting #{node.ErroMsgCount}.
try this one.
<af:setPropertyListener from="#{node.ErrorMsgCount}" to="#{pageFlowScope.Min}" type="action"/>
Hope it will work...
Sorry for late reply I tried property listener also that also not working.
After that i found the solution that the above operation is totally valid. THere was the problem with VO that was not update able.
I think what you are looking for is an actionListener. So, your code will look like:
Page
<af:treeTable value="#{bindings.SisaiEndPointView1.treeModel}" var="node"
rowSelection="single" id="TT1" contentDelivery="immediate"
columnStretching="last" partialTriggers=":::commandButton1"
editingMode="clickToEdit"
contextMenuSelect="true">
<f:facet name="nodeStamp">
<af:column id="column1" headerText="Ministry" sortable="true"
width="200%">
<af:outputText value="#{node.Ministry}" id="outputText1"/>
</af:column>
</f:facet>
<af:column id="column5" headerText="#Errors" width="100%">
<af:commandLink text="#{node.ErrorMsgCount}" id="cl2" immediate="true" partialSubmit="true" actionListener="#{pageFlowScope.EndPointBean.testInput}">
<af:setActionListener from="test #{node.ErrorMsgCount}"
to="#{pageFlowScope.Min}"/>
</af:commandLink>
</af:column>
Bean
public void testInput(ActionEvent ae) {
String str = (String)ADFContext.getCurrent().getPageFlowScope().get("Min");
System.out.println(str);
return null;
}
Few more things.
PageFlowScope is for the entire task flow. I am not sure about your use case but use the lowest scope possible.
setPropertyListener with type="action" and setActionListener are quite similar, so they will behave the same mostly.
This bean that you are using, unless it needs to persist values across pages in a task-flow, lower the scope of the bean from pageFlowScope.
try to remove the inmediate="true"
<af:commandLink text="#{node.ErrorMsgCount}" id="cl2" partialSubmit="true" action="#{pageFlowScope.EndPointBean.testInput}">
When you set inmediate to true, this skip update model phase and you don't see the changes.
Marcos
Related
I need a filter on my af:table, already tried native adf method filterVisible="true" and by setting filterable="true" but it doesn't return the results on the table. Also tried to do this using manageBean method which, I am going to post below:
jsff page
<af:commandButton text="Filter" id="cb1" actionListener="#
{pageFlowScope.paisMB.filterTableAction}"/>
<af:table value="#{bindings.PaisUVO.collectionModel}" var="row"
rows="#{bindings.PaisUVO.rangeSize}"
emptyText="#{bindings.PaisUVO.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.PaisUVO.rangeSize}"
rowBandingInterval="0" styleClass="AFStretchWidth"
selectionListener="#{bindings.PaisUVO.collectionModel.makeCurrent}"
rowSelection="single" id="t1" binding="#{pageFlowScope.paisMB.tableData}"
scrollPolicy="page" autoHeightRows="0"
filterModel="#{bindings.PaisUVOQuery.queryDescriptor}"
queryListener="#{bindings.PaisUVOQuery.processQuery}" filterVisible="true">
<af:column sortProperty="#{bindings.PaisUVO.hints.NewsiteOxiLingua.name}"
sortable="false"
headerText="#{bindings.PaisUVO.hints.NewsiteOxiLingua.label}"
id="c6">
<af:outputText value="#{row.NewsiteOxiLingua}" id="ot3"/>
</af:column>
<af:column sortProperty="#{bindings.PaisUVO.hints.NewsiteOxiPaisesPk.name}"
sortable="false"
headerText="#{bundle['lbl_codigo']}"
id="c5">
<af:outputText value="#{row.NewsiteOxiPaisesPk}" id="ot4">
<af:convertNumber groupingUsed="false"
pattern="#{bindings.PaisUVO.hints.NewsiteOxiPaisesPk.format}"/>
</af:outputText>
</af:column>
<af:column sortProperty="#{bindings.PaisUVO.hints.NewsiteOxiPaisesNome.name}"
sortable="false" filterable="true"
headerText="#{bundle['lbl_pais']}"
id="c7">
<af:outputText value="#{row.NewsiteOxiPaisesNome}" id="ot2"/>
</af:column>
</af:table>
I want to filter my last column.Below is my java code for search button.
Manage Bean Page
private transient RichTable tableData;
private RichInputText countryName;
public void filterTableAction(ActionEvent actionEvent) {
RichTable tb1 = this.getTableData();
FilterableQueryDescriptor filterQD = (FilterableQueryDescriptor)tb1.getFilterModel();
Map filterCriteria = filterQD.getFilterCriteria();
filterCriteria.put("NewsiteOxiPaisesNome", countryName.getValue());
LOGGER.warning("Filter Criteria : " + filterCriteria);
getTableData().queueEvent(new QueryEvent(getTableData(), filterQD));
AdfFacesContext.getCurrentInstance().addPartialTarget(this.getTableData());
LOGGER.warning("OnFilterTable Action is Called : " + filterQD);
}
My table is based on view object. Can anyone tell me what i am doing wrong. My table simply just dont return search result, also gives no error.
If there is anyother better way to do this i am open for suggestions. Version of jdev is 11.1.1.7.0
Under executables in the pageDef.xml file that defines the bindings to this page make sure you have PaisUVOQuery searchRegion.
It defines the search region that the filter will use to search.
E.g.
"...
..."
set the Binds to the your correct iterator. I had a similar problem and this worked for me.
I am working on a web application using jsf/ primefaces, netbeans and tomcat.
I have a datatable with some values loaded in from another table and some editable fields. My question is, after the user has edited this table how do i submit the whole table so it can be stored in a database, in a new table?
<h:form id="form" prependId="false">
<h3>All of your Paddocks</h3>
<p:dataTable var="paddock" value="#{paddock.getfromPaddock()}" editable="true">
<p:ajax event="rowEdit" listener="#{paddock.onRowEdit}" />
<p:ajax event="rowEditCancel" listener="#{paddock.onRowCancel}" />
<p:column headerText="Id">
<h:outputText value="#{paddock.idPaddock}" />
</p:column>
<p:column headerText="Name">
<h:outputText value="#{paddock.name}" />
</p:column>
<p:column headerText="Area">
<h:outputText value="#{paddock.area}" />
</p:column>
<p:column headerText="Enter Grass Weight">
<p:cellEditor>
<f:facet name="output"><h:outputText value="0" /></f:facet>
<f:facet name="input"><p:inputText id="modelInput" value="0" style="width:100%"/></f:facet>
</p:cellEditor>
</p:column>
<p:column style="width:32px">
<p:rowEditor />
</p:column>
</p:dataTable>
<h:commandButton value="Log" action="#{paddock.add}" />
</h:form>
Note that the only editable column is the grass column.
First of all, there are two main mistakes which may have undesired side effects:
<h:form ... prependId="false">
Never use prependId. Remove the whole attribute.
<p:dataTable var="paddock" value="#{paddock.getfromPaddock()}">
You should give var a different name than the managed bean. E.g. paddockItem.
As to the concrete question, your other mistake is here:
<p:inputText id="modelInput" value="0" />
You didn't bind the input value to the model. So JSF won't be able to update the model with the submitted values anyway.
Fix it accordingly, e.g.:
<p:inputText id="modelInput" value="#{paddockItem.grass}" />
In the submit method, it'll be right away there in the model.
You should only make absolutely sure that you aren't interacting with the database in the getter method of the <p:dataTable value>, otherwise you will be overwriting the model on every iteration round, hereby basically trashing the submitted values until the last row before the submit method is hit. The strange method name behind the data table value value="#{paddock.getfromPaddock()}" namely suggests that you're doing that. If it were a real property, the average starter would just have used value="#{paddock.fromPaddock}" or so.
See also:
How and when should I load the model from database for h:dataTable
I have a grisRow & within that I have 2 gridCell
In the first one, a description is displayed.
In the second cell, an action icon is displayed.
But the description is touching or overlapping with the icon.
How can I avoid this.
<af:gridCell width="50%" id="gc2" valign="top"
halign="start" marginStart="4px" marginEnd="10px">
<af:panelFormLayout id="pfl2">
<af:link id="ot11" text="#{row.name}"
clientComponent="true"
partialSubmit="true" styleClass="list-hdr-fields"
shortDesc="#{userinterfaceBundle.MANAGE_ROLES_LABEL}">
<af:clientAttribute name="uId"
value="#{row.name}"/>
<af:showPopupBehavior popupId="::manageRolesPopup"
triggerType="click"/>
</af:link>
<af:outputText value="#{row.description}"
shortDesc="#{userinterfaceBundle.DESCRIPTION_LABEL}"
id="ot12" />
<f:facet name="footer"/>
</af:panelFormLayout>
</af:gridCell>
<af:gridCell width="25%" id="gc3" valign="middle"
halign="end" marginStart="40px">
<af:panelGroupLayout styleClass="lv-row-col-right"
id="pgl2">
<af:panelGroupLayout styleClass="lv-row-col"
id="pgl16">
<af:link id="l4"
icon="/oracle/ics/webconsole/view/images/func_preferences-new_16_ena.png"
disabledIcon="/oracle/ics/webconsole/view/images/func_preferences-new_16_dis.png"
hoverIcon="/oracle/ics/webconsole/view/images/func_preferences-new_16_hov.png"
depressedIcon="/oracle/ics/webconsole/view/images/func_preferences-new_16_act.png"
iconPosition="trailing"
shortDesc="#{userinterfaceBundle.ACTIONS_LABEL}">
</af:link>
</af:panelGroupLayout>
</af:panelGroupLayout>
</af:gridCell>
</af:gridRow>
Try using af:panelGroupLayout with layout="horizontal" instead of af:panelFormLayout
add an af:spacer next to the component you need space next to and surround with panelGroup layout horizontal.
http://jdevadf.oracle.com/adf-richclient-demo/docs/tagdoc/af_spacer.html
According to the Geometry Management of <af:gridCell>:
Beware that if you attempt to use width="auto", halign="center",
halign="end" in conjunction with cell content that uses unstable,
percentage-based widths, you may experience different results in
different browsers. If you wish to use these settings, be sure to
constraint the width of that cell content.
Possible Workaround: instead of halign="end", change it to halign="stretch" (source).
I'm trying to produce a simple selection in ADF. I tried something like this:
<af:selectOneChoice label="#{bindings.items.label}" id="soc1"
value="#{bindings.items.inputValue}"
required="#{bindings.items.hints.mandatory}">
<af:selectItem id="si3" value="L" label="Left"/>
<af:selectItem id="si3" value="R" label="Right"/>
</af:selectOneChoice>
According to the documentation for af:selectItem, this should produce HTML <option> tags with the same label= and value= contents as shown in the source. However, that is not what happens. The value= attributes are changed to "1", "2" (and so on), and there is a message in the log file about not being able to convert them to integers. If I change the values to "34" and "52", just to see what happens, they are still changed to "1" and "2".
The documentation clearly says that the value= attribute specifies the value to be sent to the server, and makes no mention that it should be an integer, or that the supplied value will be replaced with a new value.
Can anyone tell me what I'm doing wrong? Or is this just the way it's supposed to work?
Here's the documentation: http://jdevadf.oracle.com/adf-richclient-demo/docs/tagdoc/af_selectItem.html
You need to set the valuePassThru attribute of <af:selectOneChoice> to true. By default its set to false, which makes the values to be indices.
<af:selectOneChoice label="#{bindings.items.label}" id="soc1"
value="#{bindings.items.inputValue}"
valuePassThru="true"
required="#{bindings.items.hints.mandatory}">
<af:selectItem id="si3" value="L" label="Left"/>
<af:selectItem id="si3" value="R" label="Right"/>
</af:selectOneChoice>
I developed a form which includes table and commandButton. Some input items are required. I want them to validate while just button pressed.
And everything was ok, this scenario was working well. But when table presents only one row, selecting row does not work. See alsa plz: https://forums.oracle.com/forums/thread.jspa?threadID=960512&start=0&tstart=0 --> might be 9th post
I applied to my jsff the solution which is told in above link. It works previous issue but this time, javascript caused another problem that is inconsistent validation. As i understood java script overrides af table immediate="true" property. plz see : http://www4.picturepush.com/photo/a/11897217/640/11897217.png
How can i resolve that? Any suggestion?
Plz help me
Thanks in advance
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich"
xmlns:trh="http://myfaces.apache.org/trinidad/html"
xmlns:f="http://java.sun.com/jsf/core">
<trh:script>
function tableLoad(event)
{
AdfCustomEvent.queue(event.getSource(), "refreshTables",
{
},
true);
event.cancel();
}
</trh:script>
......
<af:table var="row" rowBandingInterval="1" id="entityT"
value="#{pageFlowScope.incomingPaperworkBean.baseRowCollection}"
partialTriggers="::cb_incPaperDef_commit ::cb_incPaperDef_filter"
rowSelection="single" columnBandingInterval="0"
disableColumnReordering="true" columnStretching="column:c3"
styleClass="AFStretchWidth" autoHeightRows="20"
contentDelivery="immediate" immediate="true"
binding="#{pageFlowScope.incomingPaperworkBean.richTable}">
<af:clientListener method="tableLoad" type="click"/>
<af:serverListener type="refreshTables"
method="#{pageFlowScope.incomingPaperworkBean.refreshTables}"/>
<af:column id="c5" width="105">
<af:inputText id="registrationText"
value="#{row.baseEntity.registrationNumber.registrationNumber}"
required="true" readOnly="true" autoSubmit="true"
disabled="true"/>
<f:facet name="header">
<af:panelGroupLayout id="panelGroupLayout1" layout="vertical">
<af:inputText id="filterRegistrationNumber"
value="#{pageFlowScope.incomingPaperworkBean.filterTemplate.incomingPaperwork.registrationNumber.registrationNumber}"
simple="true" autoSubmit="true"/>
<af:spacer width="10" height="10" id="spacer1"/>
<af:outputText value="Kayit Numarasi" id="outputText6"/>
</af:panelGroupLayout>
</f:facet>
</af:column>
......
Set the immediate parameter on the component clicking on which fires the validation.