I need help disabling this link click without using javascript. So this is a on jsf page where the beans would set a variable to false then the cancel should not be pressable.
<p:column style="width:14%; text-align: center;">
<f:facet name="header">
<b><h:outputText value="Action" /> </b>
</f:facet>
<a href="cancel.xhtml?id=#{requestClass.requestID}">
<h:outputText value="Cancel" />
</a>
</p:column>
Thanks in advance!
Update:
<p:column style="width:14%; text-align: center;">
<f:facet name="header">
<b><h:outputText value="Action" /> </b>
</f:facet>
<h:link disabled="#{requestBean.cancelledStatus}"
outcome="cancel.xhtml?id=#{requestClass.requestID}" value="Cancel">
<f:param name="id" value="#{requestClass.requestID}" />
</h:link>
</p:column>
that didn't actually disable the button when page is loaded even though status of request is cancelled
Update 2:
this error showing when updated to following:
<h:commandButton value="Cancel" action="cancel.xhtml?id=#{requestClass.requestID}"
disabled="#{requestBean.cancelledStatus}">
<f:param name="id" value="#{requestClass.requestID}" />
</h:commandButton>
it says:
/pending.xhtml #86,150 action="cancel.xhtml?id=#{requestClass.requestID}" Not a Valid
Method Expression: cancel.xhtml?id=#{requestClass.requestID}
Instead of using normal HTML tag <a>, you should use JSF's <h:link>. This tag has the attribute disable that can be used to disable the link. In you case, it should look like this:
<h:link disable="#{requestClass.disableCancelLink}" outcome="cancel" value="Cancel">
<f:param name="id" value="#{requestClass.requestID}" />
</h:link>
Related
I have a problem with file upload. I have a page, where there is an output box. And if I need to make more then 1 mP (myProduct for example) and I add the same section all look OK. But when I fill first mP and add next, the file uploaded in first section in not OK. If I choose file in first section, and click to upload, get error "The file was not choosed"....Some tips how to solve it? btw: sorry for my english
<div class="ShadowBox whiteback RedBorderedBox ui-fluid">
<div class="CI">
<p:outputPanel styleClass="C100">
<h1 class="BT">#{msg.mP}</h1>
<div class="C100">
<p:dataList id="#{id}_mPList"
value="#{mPs}" var="rec"
type="definition" emptyMessage="No data">
<p:panelGrid columns="8" layout="grid"
style="border:0px !important; background:none;"
styleClass="ui-panelgrid-blank"
columnClasses="ui-grid-col-5, ui-grid-col-5">
<p:inputTextarea placeholder="#{msg.mPPro}"
value="#{rec.p}" disabled="#{MyBean.locked}"
rows="1">
<p:ajax listener="#{MyBean.inv()}" update="#(.buttonPanelClass)"
event="change"/>
</p:inputTextarea>
<p:fileUpload value="#{MyBean.modFile}" mode="simple" skinSimple="true" label="Choose file"
update="#{id}_mPList #(.buttonPanelClass)" />
<p:commandButton value="Upload" action="#{MyBean.saveModFile(rec, modCat)}" ajax="false"
update="#{id}_mPList #(.buttonPanelClass)" icon="fa fa-arrow-up green"/>
</p:panelGrid>
<f:facet name="footer">
<p:commandButton immediate="true"
update="#{id}_mPList #(.buttonPanelClass)"
action="#{MyBean.addMedProduct(medProducts)}"
value="#{msg.add}"
disabled="#{MyBean.locked}"/>
</f:facet>
</p:dataList>
</div>
</p:outputPanel>
</div>
</div>
</p:outputPanel>
When using autoComplete and columnToggler within a dataTable, I get a broken column-list in the column toggler.
That means, the column-list doesn't show the column-names but some javascript code instead (for each column).
Here is an example:
<p:commandButton id="showColsButton" type="button" value="Show Columns" />
<p:columnToggler datasource="myDataTable" trigger="showColsButton" />
<p:dataTable id="myDataTable" var="row" ...>
<p:column sortBy="#{row.myCol1}">
<f:facet name="header">
<div><h:outputText value="My Column 01" /></div>
<p:autoComplete ...>
<p:ajax event="itemSelect" update="myDataTable" />
</p:autoComplete>
</f:facet>
<h:outputText value="#{row.myCol1}" />
</p:column>
</p:dataTable>
Is this a bug or is there any solution for this specific problem?
Putting an input in the header facet is not valid. If you want to use it as a filter or something, put it in a f:facet name="filter".
<p:dataTable id="myDataTable" var="row" ...>
<p:column filterBy="#{row.myCol1}" sortBy="#{row.myCol1}">
<f:facet name="header">
<div><h:outputText value="My Column 01" /></div>
</f:facet>
<f:facet name="filter">
<p:autoComplete ...>
<p:ajax event="itemSelect" update="myDataTable" />
</p:autoComplete>
</f:facet>
<h:outputText value="#{row.myCol1}" />
</p:column>
But you might need to improve on the way the filter is used by not using the p:ajax but use an onchange=PF('dataTableWidget').filter(), adding a widgetVar attribute and adding filter attributes
See also
PrimeFaces showcase dataTable filter
I have the below datagrid which displays a list of student names as link.
<h:form id="gsform">
<p:dataGrid var="stuvar" rendered="#{gradeSheetController.listStudent != null}"
value="#{gradeSheetController.listStudent}" columns="5" layout="grid">
<p:commandLink actionListener="#{gradeSheetController.readStudentGradeSheet}"
update=":gsform:gscont, :gsform:buttoncont">
<h:outputText id="stname" style="font-size:16px" value="#{stuvar.studentFirstName}" />
<f:param name="selstudent" value="#{stuvar.studentSeq}" />
</p:commandLink>
</p:dataGrid>
I also have the below blockUI to freeze the screen until backend processing is done, currently used for a Save button.
<p:blockUI block=":entirePageBody" trigger="savebutton">
<h:panelGrid id="blockContent" columns="2">
<h:graphicImage library="images" name="loading.gif" style="margin-right:12px; vertical-align:middle;" />
<h:outputText value="Please wait, data is being processed..." style="white-space:nowrap;" />
</h:panelGrid>
</p:blockUI>
Now, I would also like to trigger the blockUI when the Student name link is clicked. Obviously, since the number of students will be dynamic and being within the datagrid, the code generated includes other aspects to the id like id="gsform:j_idt168:1:stname", id="gsform:j_idt168:2:stname" and so on.
Have no clue how to trigger the blockUI on click of the Student name link within the datagrid, please suggest.
Triggering/Hiding the blockUI from within dataGrid using onclick/oncomplete
<p:dataGrid var="stuvar" rendered="#{gsExamController.listStudent != null}"
value="#{gsExamController.listStudent}" columns="5" layout="grid">
<p:commandLink actionListener="#{gsExamController.readStudentGradeSheet}"
onclick="PF('bui').show()"
oncomplete="PF('bui').hide()"
update=":gsform:gscont, :gsform:remarkcont, :gsform:buttoncont">
<h:outputText style="font-size:16px" value="#{stuvar.studentFirstName}" />
<f:param name="selstudent" value="#{stuvar.studentSeq}" />
</p:commandLink>
</p:dataGrid>
<p:blockUI block=":entirePageBody" trigger="savebutton" widgetVar="bui">
<h:panelGrid id="blockContent" columns="2">
<h:graphicImage library="images" name="loading.gif" style="margin-right:12px; vertical-align:middle;" />
<h:outputText value="Please wait, data is being processed..." style="white-space:nowrap;" />
</h:panelGrid>
</p:blockUI>
A simple solution to your problem is to use Primefaces' selectors.
For example:
<p:commandLink value="Click me." styleClass="blockMeWhenClicked" />
<p:blockUI block=":ElementToBeBlocked" trigger="#(.blockMeWhenClicked)" />
Is it possible to add a link inside a tool tip using Prime Faces
i cant find a way to add a link inside the tool tip. I tried to add hideDelay but it doesn't seems to work, not sure why.
This is what i got :
<h:column id="opf1007_column_col08"
rendered="#{pc_Opf1007.w_op_forecast.colbll08 ne null}">
<f:facet name="header">
<h:outputText styleClass="outputGridHeaderText"
value="#{pc_Opf1007.w_op_forecast.colbll08}"
id="opf1007_gridheader_col08"
style="text-align:right;width:120px">
</h:outputText>
</f:facet>
<p:inputText styleClass="#{varlistOfGridForecasts_Single.inputClass}"
id="opf1007_gridinput_col08"
value="#{varlistOfGridForecasts_Single.col08}"
style="#{varlistOfGridForecasts_Single.style}color: #{varlistOfGridForecasts_Single.col08 lt 0 ? 'red' : 'blue'};width:100px;text-align:right"
readonly="#{varlistOfGridForecasts_Single.total_row}">
<f:convertNumber maxFractionDigits="0" minFractionDigits="0"/>
</p:inputText>
<p:commandButton ajax="false" type="submit"
styleClass="iconCommandButton"
id="opf1007_command_col08" icon="ui-icon-search"
action="#{pc_Opf1007.doOpf1007_command_listAction}"
style="width:14px;height:14px"
rendered="#{varlistOfGridForecasts_Single.showIcon}">
<f:param name="clicked_groupid"
value="#{varlistOfGridForecasts_Single.groupid}"></f:param>
<f:param name="clicked_col_frdate"
value="#{pc_Opf1007.w_op_forecast.col08_frdate}"></f:param>
<f:param name="clicked_col_todate"
value="#{pc_Opf1007.w_op_forecast.col08_todate}"></f:param>
</p:commandButton>
<p:tooltip for="opf1007_command_col08" value="#{msg.opf1007_tooltip_click}" showEffect="fade" hideEffect="fade" hideDelay="500"
style="width:270px"/>
</h:column>
The Result: I got my tooltip to hover over my command button, but the there is no delay in the hiding.
<p:overlayPanel appendToBody="true"
id="panel_l#{level.name.hashCode()}
f{filterTypeConfiguration.filterType.name.hashCode()}"
for="conrolForm_l#{level.name.hashCode()}f
#{filterTypeConfiguration.filterType.name.hashCode()}:
button_l#{level.name.hashCode()}f
#{filterTypeConfiguration.filterType.name.hashCode()}"
dynamic="true" >
...
and in overlayPanel I have:
<p:inputText value="#{filterTypeConfiguration.textToSearch}">
<p:ajax id="ajaxFilterSearch" event="keyup" update="overlayForm_l
#{level.name.hashCode()} f#{filterTypeConfiguration.filterType.name.hashCode()}
:select_l#{level.name.hashCode()}
f#{filterTypeConfiguration.filterType.name.hashCode()}"
</p:inputText>
I need clean data in inputText when overlayPanel is opening or closing.
I didn't use p:overlayPanel yet but I am able to trigger p:dialog diaglodReturn event like, I think it should be similar like this
<p:ajax event="dialogReturn" update="#form" listener="#{backing.refreshPage}" />
Or
Example from primefaces showcase, How about add action attribute for button?
<p:commandButton id="imageBtn" value="Basic" type="button" action="#{backing.refresh}" />
<p:overlayPanel id="imagePanel" for="imageBtn" hideEffect="fade">
<p:graphicImage name="/demo/images/nature/nature1.jpg" width="300" />
</p:overlayPanel>