Why is my <rich:popupPanel> not working? - popup

I have the following code:
<a4j:commandButton value="Adicionar BOM"
onclick="#{rich:component('addBomModal')}.show()">
<a4j:ajax event="click" immediate="true"
oncomplete="Richfaces.showModalPanel('addBomModal')"
render="addBomModal" />
</a4j:commandButton>
and
<h:form>
<rich:popupPanel id="popup" modal="true" resizeable="true"
onmaskclick="#{rich:component('popup')}.hide()">
// rest of popupPanel
</rich:popupPanel>
</h:form>
The page is rendered but nothing happens when I click the button.
How can this be solved?
Thanks in advance,
gtludwig

You have too many things going on. You first open the pop-up in onclick (button) and then open it again in oncomplete via older API (I'm not sure it was migrated to RichFaces 4). All you need is what you have in onclick, you don't need a4j:ajax.

Related

how to properly refresh p:dataView component after EntityManager saves data

So, I've encountered this situation several times when I have a component that displays records, for instance, a list of shipping addresses in a p:dataView component (but it could be any other similar component).
Each row displays a shipping address and within each row, I have an edit and delete command buttons, as shown in next snippet:
<p:dataView id="dvBillingAddresses"
...
<p:commandButton icon="pi pi-pencil"
oncomplete="PF('editBillingAddressDlg').show()"
...
The edit command button would show following dialog:
<p:dialog header="Billing Address Details" showEffect="fade" modal="true"
widgetVar="editBillingAddressDlg" responsive="true" width="450">
...
<f:facet name="footer">
<p:commandButton value="Save" icon="pi pi-check" actionListener="#{bean.saveBillingAddress}"
...
So record would be saved by calling bean method and at the end of said method, I would call PrimeFaces.current().ajax().update("...dvBillingAddresses") to refresh the p:dataView component.
However, what always happens is that the component is refreshed before the data has been completely commited to datasource, causing component to refresh with old data.
What I usually end up doing is to use an ajax close event on the edit dialog to allow extra time to update data.
<p:dialog header="Billing Address Details" showEffect="fade" modal="true"
widgetVar="editBillingAddressDlg" responsive="true" width="450">
<p:ajax event="close" update="...dvBillingAddresses" immediate="true" global="false" />
...
When I have to update components after a confirmation, and since p:confirmDialog doesn't support ajax close events; I catch the click event on the confirmation button and programmatically click a dummy command button that in turn updates the component.
I know these can't be the right approach, as they feel a bit hackish, but so far this has allowed me to continue development.
Ideally, the component should wait to refresh until the entity's #PostLoad event is fired, even if a spinning refresh icon has to show.
I'm using PrimeFaces v11, eclipselink, mysql, jakartaee v8.0 on payara server.
How is everybody else handling this?
Thanks !!!
Try adding an update= attribute to your <p:commandButton/>, so the dataView will be updated after the bean.saveBillingAddress() action is performed.
<p:dialog header="Billing Address Details" showEffect="fade" modal="true"
widgetVar="editBillingAddressDlg" responsive="true" width="450">
<h:form id="editBillingAddressForm">
....
<f:facet name="footer">
<p:commandButton value="Save" icon="pi pi-check"
action="#{bean.saveBillingAddress}"
update="#form ...dvBillingAddresses"
oncomplete="if (!args.validationFailed) PF('editBillingAddressDlg').hide()"/>

How to disable (make inactive/grey out) File button in MS Office document

I try to disable File button in MS Word.
example
I know that we can disable backstage using customUI.xml:
<customUI xmlns="http://schemas.microsoft.com/office/2009/07/customui">
<backstage>
<button idMso="FileSave" visible="false"/>
<button idMso="FileSaveAs" visible="false"/>
<button idMso="FileOpen" visible="false"/>
<button idMso="FileClose" visible="false"/>
<button idMso="ApplicationOptionsDialog" visible="false"/>
...
</backstage>
</customUI>
But i need to fully disable button. User should have no abilities even click it. I must hide backstage from users. I saw similar question. This has 1 answer which says
It's not possible to hide this button
Also, Edraw library has such possibility link. Someone has any thought?
Hiding the File tab requires you to hide the default ribbon:
<CustomUI xmlns="http://schemas.microsoft.com/office/2009/07/CustomUI"> <ribbon startFromScratch="true"/></CustomUI>
Then replace it with a new ribbon that you design from scratch.

Primefaces submit form on p:tabView tab change

I have a huge JSF application created using primefaces version 6.0 running on WebSphere Application Server, Version 8.5.5. I want to avoid nested forms so my p:tabView is not included in a form but each tab has its own form. Source for my tab view looks something like this:
<p:tabView activeIndex="#{tabViewBean.selectedTab}" id="tabView" dynamic="true" cache="false" widgetVar="tabViewWidget">
<p:ajax event="tabChange" listener="#{tabViewBean.handleTabChange}" update=":tabView" />
<p:tab id="tab1" title="First tab">
<h:form id="FirstTabForm">
<ui:include src="/views/test/firstTabTab.xhtml"/>
</h:form>
</p:tab>
<p:tab id="tab2" title="Drugi tab">
<h:form id="SecondTabForm">
<ui:include src="/views/test/secondTab.xhtml"/>
</h:form>
</p:tab>
... more tabs ...
</p:tabView>
Is there a way I can submit the form inside current tab without clicking commandButton inside it. I would like to achieve that on tab change event.
Each tab has 15-20 input fields and I don't want to use ajax on each value change because it is slowing down my application significantly.
I think you can use processattribute with a dynamic selector on tabChange event.
You can see it in action here: Ajax Framework - Partial Process

How to goto back page on click of cancel button in ZUL apge

I wanted to navigate to the browsers back page (History) onclick of Back button. How I can achieve this usign zul page? I have one option of keeping the hidden field and redirect via composer or using zk's if condition. But any other solution like javascripts function are?
You can use client side javascript in combination with Java Script's history object:
<zk xmlns="http://www.zkoss.org/2005/zul">
<div>
<button label='back'
xmlns:w="client"
w:onClick="history.back();"
/>
</div>
</zk>

SyncFusion : syncfusion dialog does not open correctly in Internet Explorer

I am using SyncFusion dialog box as below in one of my project.
<%=Html.Syncfusion().Dialog("divUpdateStatus")
.Title("Update Status")
.AutoOpen(false).Modal(true).Width(550).Height(370)
.AutoFormat(Skins.Office2007Black)
.Resizable(false)
%>
It does work fine in all the browsers except Internet Exploere(any version).
When I click on the button to open this dialog, it does open but everything is inactive.
All the buttons and textboxes on the dialog are disabled.
Not even Cross button to cancel the dialog is enabled to close the dialog.
I have to press 'ESC' to comeout of this, then again I click on button to open that, it works fine.
On the added reference of the Syncfusion dll, it shows Version: 10.204.0.56
Anyone has idea on this?
Thank you,
I have used Syncfusion Dialog in my application, but it is working fine in Internet Explorer for me. My application referred jquery-1.4.2 script and jquery-ui-1.8.22 script within it. Dialog is working fine with this.
I have used Syncfusion version 10.2.0.56 and use the below code to render Dialog,
<code>
<div id="divUpdateStatus" style="visibility: hidden;">
<%=Html.Label("lbl", "UserName") %>
<%=Html.TextBox("text")%><br /><br />
<%=Html.Label("lbl2", "Password")%>
<%=Html.TextBox("text")%><br /><br />
<%=Html.Syncfusion().Button("btn").Text("Submit")%>
</div>
<%=Html.Syncfusion().Dialog("divUpdateStatus").Title("UpdateStatus").AutoOpen(false).Modal(true).Width(550).Height(370).AutoFormat(Skins.Office2007Black).Resizable(false) %>
<%=Html.Syncfusion().Button("button").ClientSideOnClick("onclick").Text("Click to open the dialog")%>
<script type="text/javascript">
function onclick(sender, args) {
$("#divUpdateStatus").dialog("open");
}
</script>
</code>
Share more details or issue reproducible steps in detail and we will see what’s wrong with your code.
Regards,