commandButton issue - oracle-adf

Currently I have a two commandButtons:
one to execute a validation using actionlistener that populates a Return.inputValue
and another to move the return value from the previous listener to a
pageflowscope variable as below
<amx:commandButton text="commandButton1" id="cb4" action="godecide">
<amx:setPropertyListener from="#{bindings.Return.inputValue}" type="action" to="#{pageFlowScope.ReturnValue}"/>
</amx:commandButton>
<amx:commandButton actionListener="#{bindings.CheckUser.execute}" text="CheckUser"
disabled="#{!bindings.CheckUser.enabled}" id="cb3"/>
How can achieve this with one command button please?

I think you can call a method in the button action and within that method take the value from Return, set this value whenever you want and then redirect the page to some other page. As you want to have this value in pageFlowScope, define the scope of the bean in adfc-config as pageFlow or I thing Session should be fine as well.

There are two approaches:
Do everything you need within the taskflow action. Thats the action you have described in first button, you can add method call, used in the second button as a listener.
Do all the job in your bean. Set actionListener in the button, that will handle all the work needed to be done.
In both cases you can keep propertyListener to set this value.
Give more details on the case, if you need further explanation.

in first command button execute method via action which will your required task and in actionListner pass that generated value to other manager that is fine.
by this you no need to use sesssion moreover session are havey.

Related

Forcing Object Data Source To Reinstantiate

I am using the XPages Mobile Controls with an Object data source (Java Class which is NOT a managed bean) tied to View scope on a second app page. I have resetContent on the second page set to true. So I would have assumed the Object Data Source would be destroyed and recreated every time I transitioned to the second page.
When I transition to the second page the first time, the createObject() method is invoked as expected. If I transition to the second page using a button AND set forceFullRefresh to true the createObject() method is invoked. If, however I have a Rounded List Item with a moveTo specified for the second page the createObject() method does not get invoked. Instead the object remains set to the last value it was using when that application page was last accessed.
Is there a way to force the createObject() method to be invoked every time I transition to the page?
Another way is to call the refresh method of the datasource in SSJS.
Assumning you have only one datasource on the page, you can access the ObjectDataSource from the view:
var ods:com.ibm.xsp.extlib.model.ObjectDataSource = view.getData().get(0);
ods.refresh()
This executes the createObject method binding and reinstantiate the datasource.
The solution turned out to be to move the object data source from view scope to request scope. This is possible because I do not have the need for any partial refreshes on that page until the details are ready to be submitted.

Get the command link clicked in adf?

I have 50 different command links on a jsff page. I want to get the commandlink clicked in the backing bean? How to do this? I just have to use one single method in the backing bean
Write a listener and call the same listener on all of your command links. Inside the Listener Metod call event.getAttributes() which will return the Map of attributes. From the Map you can find the id property of the link submitted by the user.
Simply attach an actionListener:
<af:commandLink text="Command link 1" actionListener="#{bean.link1}"/>
<af:commandLink text="Command link 2" actionListener="#{bean.link2}"/>
<af:commandLink text="Command link 3" actionListener="#{bean.link3}"/>
...
The methods link1, link2, link3 etc. are called when you press the corresponding command link, so you implicitly know which link has been pressed.
Write a listener in backing bean , listener method will have "ActionEvent" as an argument.
ActionEvent has apis getSource(),getComponent(), which can be leveraged to get the commandlink clicked.
if you want to call 50 command link from backing bean,
you can queue them one after- see
Invoking Button Action Programmatically,Queuing ActionEvent

AngularJS Save Browse History

I'm trying to solve a problem. I want that when a perform an action or function in the controller to be saved in the brose history. For example, I want to do this:
Type something in a textbox.
Click a link to call a function that will set the string I typed to a variable in $scope and save it at the browser history.
Do the same as the previous step with a different value.
If I click the "back" button from the browser, I want to display the first value I entered.
I have a very simple example of what I want but I don't know what do I have to add to be able to use the "back" and "forward" button from the browser.
http://jsfiddle.net/XMFua/
Thank you very much in advance!
You should use the $location service to set the URL. I don't know how to make it work on jsFiddle, however the following should work:
http://jsfiddle.net/marcenuc/BSDxG/

Show custom pop up warning message when user changes any value (text box/LOV) on page

I have requirement to show custom pop up warning message when user changes any value (text box/LOV) on page and close tab/cancel button by mistake.
Option I tried are:
a) Within application we are using a complex task flow/RegionModel for 7 different scenario's. Also requirement is to display custom message - Hence could not use approach "unsaveddatawarning"
http://www.oracle.com/technetwork/developer-tools/adf/unsaveddatawarning-100139.html
b) Second option I tried was to have custom region controller:
CustomRegionController implements RegionController
Inside validateRegion(RegionContext regionContext) thought to find if page data is dirty
AdfFacesContext.getCurrentInstance().getDirtyPageHandler().isDataDirty();
or
DCBindingContainer dcBindings = (DCBindingContainer)BindingContext.getCurrent().getCurrentBindingsEntry();
DCDataControl cDataControl = dcBindings.getDataControl();
boolean dirtyFlag = cDataControl.isTransactionModified();
In both scenario it always gives true (seems due to common set of VO/View Link application module always gets dirty when data is being rendered on page load).
Last option I am left with is to invoke valueChangeListener for each element (textbaox, LOV, Check box). I do not like this option at all. Please suggest if there can be better way to handle this scenario.
Why is using a value change listener a problem? Have each input component call the same VCL method in the backing bean. If necessary you can get the component id from the vcl event object.

gridfilter load store by a custom method

if in an extjs grid filter, I set the autorelaod to false and I want to reload the store when the user clicks outside the filter, how do I go about it? I am looking at:
filter.onblur(
check to see if filter value has changed
if yes,
fire :'updateFilter'
)
Is this correct?
The second question is: If I wish to load the store via a custom loader method...I cannot afford to call 'updatefilter'. But I am at a loss to figure out what are the events I need to fire in sequence so that my custom method will be called.(instead of the default store.load)
Thank you
I think the event is 'update'.
Explained in docs 'Ext.data.Store-event-update'

Resources