So heres the skinny of it. I have a rendered tag on my selectOneMenu. I've tried it in various ways, this last one updating the form in the boolean checkbox with the "#form". I am all out of ideas, been working on it for a few days. What am I missing so I can render/unrender based on the selection of the checkbox? Thanks.
<rich:dataTable id="catalogview" width="100%" style="width: 100% !important"
columnClasses="lcolumnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog,columnCatalog"
value="#{pcnAlerts.notifications}" var="pcn" rows="20"
headerClass="headerCatalog" styleClass="table1" footerClass="footer_td" >
<h:column>
<h:selectBooleanCheckbox value="#{pcn.checked}" update="#form" >
<f:ajax listener="#{pcnAlerts.selectItem}" render=":popupForm:popupPanelContents" />
</h:selectBooleanCheckbox>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Status" />
</f:facet>
<h:outputText value="#{pcn.status}" />
<h:selectOneMenu id="StatusMenu" value="#{pcnAlerts.newStatus}" rendered="#{pcn.checked}">
<a4j:ajax update="StatusMenu" listener="#{pcnAlerts.saveStatus()}" />
<f:selectItem itemValue="" itemLabel="New" />
<f:selectItem itemValue="Pending" itemLabel="Pending" />
<f:selectItem itemValue="Complete" itemLabel="Complete" />
<f:selectItem itemValue="Archive" itemLabel="Archive" />
<f:selectItem itemValue="Disregard" itemLabel="Disregard" />
</h:selectOneMenu>
</h:column>
</rich:dataTable>
You must also update catalogview in order to render the components inside the table. Also, make sure your <rich:dataTable> is inside a <h:form>:
<h:form id="frmCatalog">
<rich:dataTable id="catalogview" value="#{pcnAlerts.notifications}" var="pcn">
<h:column>
<h:selectBooleanCheckbox value="#{pcn.checked}">
<f:ajax listener="#{pcnAlerts.selectItem}"
render=":popupForm:popupPanelContents :frmCatalog:catalogview" />
</h:selectBooleanCheckbox>
</h:column>
</rich:dataTable>
</h:form>
Related
I'm working with a <p:overlayPanel> that includes a couple of <p:selectOneMenu>s, as well as several other components. When the <p:selectOneMenu>s are opened, some of the fields fall outside of the <p:overlayPanel>, and clicking on them causes the panel to close. (See image below).
.
.
.
One solution would be to modify the <p:overlayPanel> as follows:
dismissable="false"
showCloseIcon="true"
Another would be to modify the <p:selectOneMenu>:
height="50"
I'm looking for some options for solutions that are as simple as possible and preferably don't involve a change to the UI (the above solutions both change the UI). Is there a way to keep the <p:overlayPanel> open when a click outside of it falls within one of its <p:selectMenu>s?
More Complete Code
<p:overlayPanel styleClass="col-settings-panel"
id="colSettingsPanel"
for="columnSettingsBtn"
hideEffect="fade"
widgetVar="wvcolSettingsPanel"
rendered="#{empty rendered ? 'true' : rendered}" >
<p:pickList id="pickList"
value="#{fileSearchPersonalizationBean.columns}"
var="column"
showSourceFilter="true"
itemLabel="#{column}"
itemValue="#{column}"
itemDisabled="#{column eq 'Ref No'}">
<p:ajax event="transfer" listener="#{fileSearchPersonalizationBean.onTransfer}" update="pickList availableCount selectedCount selectSortBy" />
<f:facet name="sourceCaption">
<h:outputText value="Available Columns ("/>
<h:outputText id="availableCount" value="#{fileSearchPersonalizationBean.sourceCount}"/>
<h:outputText value=")"/>
</f:facet>
<f:facet name="targetCaption">
<h:outputText value="Selected Columns ("/>
<h:outputText id="selectedCount" value="#{fileSearchPersonalizationBean.targetCount}"/>
<h:outputText value=")"/>
</f:facet>
</p:pickList>
<p:panelGrid columns="1">
<p:outputPanel styleClass="col-settings-panel-option">
<h:outputLabel value="Sort By: " />
<p:selectOneMenu id="selectSortBy"
value="#{fileSearchPersonalizationBean.sortBy}" >
<p:ajax listener="#{fileSearchPersonalizationBean.sortByChanged}" />
<f:selectItems id="sortByList" value="#{fileSearchPersonalizationBean.columns.target}" />
</p:selectOneMenu>
</p:outputPanel>
<p:outputPanel styleClass="col-settings-panel-option">
<h:outputLabel value="Items per Page:"/>
<p:selectOneMenu id="selectRows" value="#{fileSearchPersonalizationBean.sRows}" >
<f:selectItem itemLabel="10" itemValue="10" />
<f:selectItem itemLabel="25" itemValue="25" />
<f:selectItem itemLabel="50" itemValue="50" />
<f:selectItem itemLabel="100" itemValue="100" />
</p:selectOneMenu>
</p:outputPanel>
</p:panelGrid>
<p:panelGrid styleClass="toolbar" columns="2">
<p:outputPanel>
<p:commandButton styleClass="btn-secondary"
id="loadDefaults"
value="Reset Defaults"
update="selectSortBy pickList selectRows"
actionListener="#{fileSearchPersonalizationBean.loadDefaultVO}" />
</p:outputPanel>
<p:outputPanel styleClass="toolbar-right">
<p:commandButton styleClass="btn-secondary"
id="columnClose"
value="Cancel"
actionListener="#{fileSearchPersonalizationBean.panelCancel}"
immediate="false">
<f:attribute name="panelId" value="#{formId}:colSettingsPanel" />
</p:commandButton>
<p:commandButton styleClass="btn-primary"
id="columnSubmit"
value="Save & Apply"
actionListener="#{fileSearchPersonalizationBean.panelSave}"
oncomplete="refreshSearchResults();" >
<f:attribute name="panelId" value="#{formId}:colSettingsPanel" />
</p:commandButton>
</p:outputPanel>
</p:panelGrid>
</p:overlayPanel>`
i am beginner in JSF ,i have a problem with selectonemenu item.When i choose the an item ,for example ' FirstLabel',outputpanel should be shown.However ,selectone menu does not update my choice.I use primefaces 3.1 library.How can i solve this problem.Thanks for helps.
<p:selectOneMenu value="#{denemeView.str}" effect="fold" editable="true" >
<f:selectItem itemLabel="Please choose!." itemValue="" />
<f:selectItem itemLabel="FirstLabel" itemValue="1" />
<f:selectItem itemLabel="SecondLabel" itemValue="2" />
<p:ajax process="#this" update=":Form2:panel1"/>
<p:ajax process="#this" update=":Form2:panel2"/>
</p:selectOneMenu>
</p:outputPanel>
<p:outputPanel id="panel1" rendered="#{denemeView.str=='1'}">
<h:outputText value="Output: * " />
<p:inputText id="out" value="#{denemeView.islem}" />
</p:outputPanel>
<p:outputPanel id="panel2" rendered="#{denemeView.str=='2'}">
<h:outputText value="True choice! " />
</p:outputPanel>
If a JSF component has rendered="false" set then it's not redered (the component object is not present in the object tree) and cannot be updated using <p:ajax update="someId"/> or <f:ajax render="someId"/>. What you need to do is wrap these two panels in an outer panel and update that one. Something like this:
<p:ajax process="#this" update="outerPanel"/>
...
<p:outputPanel id="outerPanel">
<p:outputPanel id="panel1" rendered="#{denemeView.str=='1'}">
<h:outputText value="Output: * " />
<p:inputText id="out" value="#{denemeView.islem}" />
</p:outputPanel>
<p:outputPanel id="panel2" rendered="#{denemeView.str=='2'}">
<h:outputText value="True choice! " />
</p:outputPanel>
</p:outputPanel>
See here for a similar problem.
JSF 1.2 CommandButton not Working
<h:dataTable first="0" rows ="#{aptMgmtUIHandler.usocsOnFirstPanel}"
value="#{aptMgmtUIHandler.appt.usocList}" cellspacing = "3" var="usoc">
<h:column>
<h:outputText value="#{usoc.displayName}"></h:outputText>
<h:outputLabel value=":"></h:outputLabel>
</h:column>
<h:column rendered="#{usoc.displayName eq 'Ethernet Tech Install (1CRMM)'}">
<h:selectOneMenu value="#{usoc.usocQuantity}" style="height:22px"
rendered="#{usoc.booleanType}">
<f:selectItem itemLabel="NO" itemValue="#{aptMgmtUIHandler.no}" />
<f:selectItem itemLabel="YES" itemValue="#{aptMgmtUIHandler.yes}" />
</h:selectOneMenu>
<h:inputText value="#{usoc.usocQuantity}" style="height:17px"
rendered="#{!usoc.booleanType}"
onchange="return isNumeric(this.value, '#{usoc.displayName}')">
</h:inputText>
</h:column>
<h:column rendered="#{usoc.displayName ne 'Ethernet Tech Install (1CRMM)'}">
<h:selectOneMenu value="#{usoc.usocQuantity}" style="height:22px"
rendered="#{usoc.booleanType}" >
<f:selectItem itemLabel="NO" itemValue="#{aptMgmtUIHandler.no}" />
<f:selectItem itemLabel="YES" itemValue="#{aptMgmtUIHandler.yes}" />
</h:selectOneMenu>
<h:inputText value="#{usoc.usocQuantity}" style="height:17px"
rendered="#{!usoc.booleanType}"
onchange="return isNumeric(this.value, '#{usoc.displayName}')">
</h:inputText>
</h:column>
</h:dataTable>
<h:commandButton id="nextAdd" value="Next" styleClass="button"
action="#{aptMgmtUIHandler.getCalendarFromCTS}"></h:commandButton>
My Bean Scope in xml is session. After clicking on the button its not calling the backbean method.
Its not showing any Error message. After removing the render its calling the method.
So I have the following table:
<h:dataTable id="shoppingCartTable" value="#{cartBean.shoppingCartList}" var="shoppingCartItem" width="100%" >
<h:column>
<f:facet name="header">
<h:outputText value="Item" />
</f:facet>
<h:commandLink value="#{shoppingCartItem.name}">
</h:commandLink><br/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Quantity" />
</f:facet>
<h:inputText id="quantity" value="#{shoppingCartItem.quantity}" size = "2" /><br/>
</h:column>
</h:dataTable>
With the following commandButton
<p:commandButton
value="Submit"
>
<f:ajax event="click"
execute="shoppingCartTable"
render="#all" />
</p:commandButton>
Now there is a lot of other stuff on the page and all I want to do is update the Quantity values of the shopping cart items but this does not seem to be working. Am I doing something wrong?
Try to replace f:ajax with p:commandButton attributes:
<p:commandButton value="Submit" update="#all" process="shoppingCartTable"/>
I'm trying to build an editable table to enter values of a buy order detail. I have a rich:datatable bound to a List, and I dinamically add rows to the table by adding elements to the list. The entity has two fields that must be entered manually so I'm using h:inputTexts to do it, but the values that are entered on those fields are not being saved to the objects in the list. I tried to do this with a rich:inplaceInput too(following the exact instructions on the Exadel Richfaces livedemo), to no avail. This is my code:
<rich:panel>
<f:facet name="header">#{messages.DetalleOrdenCompra}</f:facet>
<h:outputLabel value="#{messages.Codigo}" for="txtCodigo" /> #{' '}
<h:inputText id="txtCodigo">
<rich:suggestionbox id="suggestionBox" for="txtCodigo"
var="consumible" fetchValue="#{consumible.conNombre}"
suggestionAction="#{ordenCompraHome.autoComplete}" minChars="1"
reRender="tablaDetOrdComp" ignoreDupResponses="true"
bypassUpdates="false">
<h:column>
<f:facet name="header">#{messages.Codigo}</f:facet>
<h:outputText value="#{consumible.conNumber}" />
</h:column>
<h:column>
<f:facet name="header">#{messages.Descripcion}</f:facet>
<h:outputText value="#{consumible.conNombre}" />
</h:column>
<a:support event="onselect" immediate="true"
ignoreDupResponses="true" bypassUpdates="false">
<f:setPropertyActionListener value="#{consumible}"
target="#{ordenCompraHome.conActual}" />
</a:support>
</rich:suggestionbox>
</h:inputText>
#{' '}
<!-- Add elements to the list -->
<a:commandButton type="button" value="#{messages.Agregar}"
action="#{ordenCompraHome.anadirSeleccionadoADetalle()}"
reRender="tablaDetOrdComp" immediate="true" />
<!-- Hitting this button after entering any values in the table below shows that the values are never updated -->
<a:commandButton type="button" value="Refrescar tabla"
reRender="tablaDetOrdComp" immediate="true" />
<br />
<br />
<rich:dataTable value="#{ordenCompraHome.detalleOrdenCompra}"
var="detOrdComp" id="tablaDetOrdComp" rowKeyVar="row">
<rich:column width="5%">
<f:facet name="header">
<h:outputText value="#"></h:outputText>
</f:facet>
<h:outputText value="#{row+1}"></h:outputText>
</rich:column>
<!-- ... more columns, just data output -->
<!-- The two following columns are user inputs -- no updates in the underlying list when entering any value, both values are always null -->
<rich:column width="10%">
<f:facet name="header">
<h:outputText value="#{messages.Cantidad}"></h:outputText>
</f:facet>
<s:decorate template="layout/edit-nolabel.xhtml">
<h:inputText value="#{detOrdComp.ordCantidad}" id="txtCantidad" required="true">
<!-- tried with both events, onblur and onviewactivated, first each on on its own, then both together, no results -->
<a:support event="onblur" reRender="columnaMonto" immediate="true"
bypassUpdates="false" ajaxSingle="true" />
<a:support event="onviewactivated" reRender="columnaMonto" immediate="true"
bypassUpdates="false" ajaxSingle="true" />
</h:inputText>
</s:decorate>
</rich:column>
<rich:column width="10%">
<f:facet name="header">
<h:outputText value="#{messages.CostoUnitario}"></h:outputText>
</f:facet>
<s:decorate template="layout/edit-nolabel.xhtml">
<h:inputText value="#{detOrdComp.ordCostoUnitario}"
id="txtCostoUnitario" required="true">
<a:support event="onblur" reRender="columnaMonto"
immediate="true" bypassUpdates="false" ajaxSingle="true" />
<a:support event="onviewactivated" reRender="columnaMonto" immediate="true"
bypassUpdates="false" ajaxSingle="true" />
</h:inputText>
</s:decorate>
</rich:column>
<!-- This column is the result of a multiplication between txtCantidad and txtCostoUnitario -- I don't get anything here since both factors are null (null values have been properly handled so 0.0 is displayed when any of the factors is null) -->
<rich:column id="columnaMonto" width="10%">
<f:facet name="header">
<h:outputText value="#{messages.Monto}"></h:outputText>
</f:facet>
<h:outputText value="#{detOrdComp.ordSubparcial}"></h:outputText>
</rich:column>
</rich:dataTable>
Bean:
// Underlying list. I used just #DataModel, then #DataModel(scope = ScopeType.PAGE), no results
#DataModel(scope = ScopeType.PAGE)
public List<OrdenCompraDetalle> getDetalleOrdenCompra() {
return detalleOrdenCompra;
}
Instead of the s:decorates I was using something like this before (from the Livedemo), but it didn't work, either
<rich:dataTable value="#{dataTableScrollerBean.allCars}" var="car" width="350px" columnClasses=",columns,columns,columns" rows="15" id="table" rowKeyVar="row">
<rich:column>
<f:facet name="header">
<h:outputText value="Price" />
</f:facet>
<rich:inplaceInput layout="block" value="#{car.price}"
id="inplace" required="true" selectOnEdit="true" editEvent="ondblclick">
<a4j:support event="onviewactivated" reRender="table, messages"/>
</rich:inplaceInput>
</rich:column>
What am I missing here? Any help would be appreciated. Thanks in advance.
I think that your problem is the ajaxSingle="true" attribute. This attribute means that, even if all the input elements in the form are submitted, only the input the one that triggered the submit will be processed.
If this is the problem, you can try any of the following (I assume that the a prefix is the common a4j prefix?):
Add the id of the h:inputText, to the processed attribute to <a:support>. This will force the input of the specific row to be processed. For example (not tested):
<h:inputText value="#{detOrdComp.ordCostoUnitario}"
id="txtCostoUnitario" required="true">
<a:support event="onblur" reRender="columnaMonto"
immediate="true" bypassUpdates="false" ajaxSingle="true" processed="txtCostoUnitario" />
<a:support event="onviewactivated" reRender="columnaMonto" immediate="true"
bypassUpdates="false" ajaxSingle="true" processed="txtCostoUnitario"/>
</h:inputText>
Remove the ajaxSingle and instead surround the <h:inputText> in a a4j:region (analogous to ajaxSingle with processed, here all the inputs in the closest/enclosing region are processed):
<a4j:region>
<h:inputText value="#{detOrdComp.ordCostoUnitario}" id="txtCostoUnitario"
required="true">
<a:support event="onblur" reRender="columnaMonto"
immediate="true" bypassUpdates="false" />
<a:support event="onviewactivated" reRender="columnaMonto"
immediate="true" bypassUpdates="false" />
</h:inputText>
</a4j:region>
Remove the ajaxSingle. This will cause all the elements in your form to be processed. Will take more time.
enter code here