Oracle ADF: richButton.setDisabled(true) not working in 12c - jsf

Hello I am using jdeveloper 12c. I have a test.jsf page in that I have form with a button. In the backing bean of this page I have actionListener method addKPI(ActionEvent e). when user click this button it calls addKPI() method. In this method I am doing some operations and after that I am trying to disable it using richButton.setDisable(true). It is not working in 12c. It is working in jdeveloper 11.1.2.4.
Please help me. How do I achieve this. My requirement is when user click this button I need to disable it. Means the button should be clickable only once.
Thanks in advance.

You can try firing a programatic PPR from the action listener:
public void addKPI(ActionEvent e) {
.........
richButton.setDisable(true);
AdfFacesContext.getCurrentInstance().addPartialTarget(richButton);
}

Related

primefaces close dialog on init don't work

Im'using Primefaces 5.0 and I tried to use PF Dialog Framework features, but with some problems.
I open a dialog using openDialog() method.
In the dialog bean I managed an init() method annotated with #PostConstruct.
In that method I read parameters and load a list of records (to bind with a dataTable).
All seems work fine... dialog opens, I choose a record , close with closeReturn and so on.
But I want that in init(), if a single record was found, I could close immediately the dialog.
So I call closeDialog(), passing my bean... but nothing happens... the dialog opens and I have to close it manually.
And this is frustrating...
Could anyone help me?
Thanks
You can use primefaces requestContext to close the dialog from your bean.
#PostConstruct
public void init() {
recordList = loadListOfRecords();
if ( recordList.size() == 1 ) {
RequestContext.getCurrentInstance().execute('yourDialogWidgeVar.close()');
}
}
This is just a possibility to close a dialog from Bean. I don't know if it fits to your demands.
Please post your code next time. It is hard to figure out your problem without it.

Modal launch button with actionlistener

I've been trying to use a f:setPropertyActionListener on a Bootstrap modal launch button but it doesn't work at all. Tags a and button don't support it so I don't know what to do now.
I need to set an id of an item in a bean I have when I push the modal launch button, so I can then confirm delete that item using the modal.
I've searched here and on other sites and I've found a lot of solutions to my specific problem using Javascript but I have no idea about that :/
Thanks in advance.

Xpage Component using UIDialog, UIDialog does not render its children

I am trying to develope a component for my company wich should have an integrated dialog. Creating the component was easy until i hit the point with the Dialog. I want to use the com.ibm.xsp.extlib.component.dialog.UIDialog for my component because it has some nice features wich i want to use so creating my own dialog with a ClientSideDojo is not an option.
Normaly when adding a component to another i use component.getChildren().add(MyNewComp),but when i try this Code:
public class myComponentWithADialog extends UIComponentBase implements FacesComponent {
//...other Code...
public void buildContents(FacesContext context, FacesComponentBuilder builder)
throws FacesException {
UIDialog dialog = new UIDialog();
TypedUtil.getChildren(container).add(dialog);
dialog.setStyleClass("dlgUserPref");
dialog.setTitle("titelxyz");
dialog.setId("TagDialog");
UIPanelEx panel = new UIPanelEx();
panel.setTagName("div");
panel.setStyle("border:2px solid red;");
panel.setStyleClass("lotusList lotusTags lotusRelatedTags");
dialog.getChildren().add(panel);
this.getChildren.add(dialog);
}
//....
}
My Panel does not display inside the dialog when calling XSP.openDialog('dialogClientId') in my browser the dialog is shown but empty.
I already tried several other methods like dialog.getPopupContent.getChildren().add() but then i get the error: javax.faces.component.UIPanel incompatible with com.ibm.xsp.extlib.component.dialog.UIDialog$PopupContent.
Also i tried to find a solution on google but i only found a entry at openNTF from someone with the same problem but also without any solution.
Note: I also tried to 'inject' some content to a standard <xe:dialog> and to a <px:panel> inside the <xe:dialog> via a button with SSJS like keithstric does in his blog. Code:
var dialog:com.ibm.xsp.extlib.component.dialog.UIDialog =
getComponent('extlibdialog');
if(dialog.getChildren().size() > 0) {
dialog.getChildren().clear();
}
var TextField:com.ibm.xsp.component.xp.XspOutputText = new com.ibm.xsp.component.xp.XspOutputText();
TextField.setTitle("test");
TextField.setId("testTextField");
TextField.setValue("<p>This is the new Content</p>");
dialog.getChildren().add(TextField);
This code works fine for a standard <xp:panel> outside a dialog but not on the dialog itself or a panel inside it.
The dialogue is not pre - rendered when the page is loaded, but when you actually call for it in XSP.openDialog(...)
So you need to get your code run in that event (mobile now, can't check if it is exposed).
Plan B: do use a Dojo dialogue that is backed by a rest control, so you can transport whatever data you need back and forth.
A word of caution: popup dialogs are a UI concept transplanted from desktop apps. They are alien to Web apps and mostly not working in mobile. Consider and Inline form instead (or a wizard)

Confirmation dialog for Cancel button in sharepoint webpart

hi i am creating a webpart. i have a custom toolpart for my webpart. there i'll type some text. when i click save it will print in sharepointpage. when an user click cancel in webpart's toolpart i need to ask confirmation dialog and if the user selects "OK" i need to run some server side code. is it possible. Please help me on that.
In your toolpart register an onsubmit event handler (this will be called on OK/Apply/Cancel or if you do anything else that causes a postback)
protected override void OnPreRender(EventArgs e)
{
// Don't run if in SharePoint Designer
if (ParentToolPane.InCustomToolPane)
return;
// Connect to the form Submit event RenderToolPart event is too late,
// Putting this in OnLoad event causes javascript error webpart may
// be loaded for ApplyChanges but not rendered - leading to javascript error
this.Page.RegisterOnSubmitStatement("submit", "yourCustom_onSubmit();");
base.OnLoad(e);
}
Also be sure to have a javascript function yourCustom_onSubmit on your page - putting up a confirmation message and cancelling submit is up to you.
Yes you can. It's like asp.net, so you can insert a Javascript, like the sample we found at this site.

How to create a popup for edit button in JSF page in jDeveloper 12c?

How to create a popup for edit button in JSF page in Oracle jDeveloper 12c?
There is nothing special about JDeveloper 12c when it comes to working with popups. You can see a sample here that automatically migrates to 12c:
http://andrejusb.blogspot.co.uk/2009/11/crud-operations-in-oracle-adf-11g-table.html
Drag and drop popup onto the form from component palette. Design as needed. Make note of popup ID. D&D Operation (from component palette) > Show Popup Behavior onto button. Set popup id to id of previously created popup. Select method to launch, like action. Google is your friend here. Search "ADF Popup" - lots of hits, like this. Remember to upvote those of us who take time to help you here.

Resources