Is there a way to disable the entire dataTable
in Primefaces? Somebody suggested to use the editable
component but that doesn't seem to help.
#{conversionRatesBean.readOnlyUser}
is the code that filters out the group of users.
I am using Primefaces 3.5 and JSF 2.1.6
If not in Primefaces, can somebody suggest some solutions in jQuery?
<div class="grid_12 width_75_pc margin_left_auto" >
<div class="datatable">
<p:dataTable editable="#{!conversionRatesBean.readOnlyUser}" id="conversionRateTable" var="row" value="#{conversionRatesBean.rowNames}" rowIndexVar="rowIdx" styleClass="projectTable table-container">
<p:column headerText="" styleClass="#{rowIdx == -1 ? 'itPanelGreen' : 'ui-widget-header'} textAlignCenter valign-middle width_20_pc column_name" >
<h:outputText value="1 #{row.name} =" />
</p:column>
<p:columns var="column" value="#{conversionRatesBean.colNames}" headerText="#{column.name}" columnIndexVar="colIdx"
styleClass="#{rowIdx == colIdx ? 'itPanelGreen' : 'textAlignCenter'}">
<input:decimalField beanValue="#{conversionRatesBean.conversionMap[row][column].conversionValue}"
errorMsg="#{msgs['errorInvalidValue']}"
rendered="#{rowIdx != colIdx}"
decimalFields="4"
errorDecimal="#{msgs['packaging.error.number.decimals']}"
styleClass="textAlignRight "
maxLength="9"/>
</p:columns>
</p:dataTable>
</div>
</div>
<div class="actions grid_12 alpha">
<p:commandButton id="saveBtn" value="Save" update="conversionRateTable"
action="#{conversionRatesBean.save}"
oncomplete = "qt.removeSavedState();"
disabled="#{conversionRatesBean.readOnlyUser}"
styleClass="js-saveButton button" onstart="screenUtils.triggerRequired(); if(screenUtils.errorsOnPage()){return false;}"/>
<pretty:link mappingId="rateSelection" styleClass="displayInlineBlock margin_top_5">
<f:param value="#{conversionRatesBean.rateId}" />
<h:outputText value="#{msgs.backtoOverView}" styleClass="linky margin_left_10" />
</pretty:link>
</div>
I managed to fix the issue by doing this:
Added the following line of code in the decimalField.xhtml
page, which was essentially a composite implementation for the input tag.
<composite:interface> <composite:attribute name="disabled" default="#{false}"/> </composite:interface>
Thereafter, from the using page conversionRates.xhtml
called the composite attribute as below:
<input:decimalField disabled="#{conversionRatesBean.readOnlyUser}"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.