ValueChangeListener

Forum sobre a ferramenta Oracle JDeveloper, ADF, OAF, etc. (Não é destinado ao aprendeziado da Linguagem Java em geral)
Post Reply
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

I had asked the following question:

How do I select an item on a ListBox and so I select it running an action? ... without having to press a button? .... I tried to use the 'OnClick' property ... but it does not work ... I also wanted to know how to do this in an 'ADF Read Only Table' ... as soon as the user selected a line .. I wanted you to already executed An action ... but on his 'OnClick' property is not running the action ....

And then Victor told me that I should follow the following steps:

You need to mecher in 2 attributes of your component
1 - autosubmit = "true"
2 - valuechangelistener = "# {nomedobean.nomedomode}"

99] But I made these two steps ... In the valuechangelistener I called the same method as the button called ....
and every time I selected the item .. it did nothing ... it was as if I were updating the screen by clicking on it .. but he did not run the action I wanted him executed ....
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

I understood it was for an AF: Selectonechoice
post the codigo of the component and also the method q is called
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

Select the item that you speak is click on the radion button ??

I find it very difficult you can do this ...
just clicking on the registry directly or selecting the radionbutton and clicking open
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

Well ... I tried to do it for a selector too ... but it did not work também ...

VO Post the selection code ....

JSP

Select all

 
       <af:panelForm rows="1"> 
            <af:selectOneChoice value="#{bindings.wplaca.inputValue}" 
                                label="Selecione a O.S. do Transporte" 
                                autoSubmit="true" 
                                valueChangeListener="#{backing_Montagem_transporte.Pesquisar_action}"> 
              <f:selectItems value="#{bindings.wplaca.items}"/> 
            </af:selectOneChoice> 

Select all

 
 
    public String Pesquisar_action() { 
        BindingContainer bindings = getBindings(); 
        OperationBinding operationBinding = 
            bindings.getOperationBinding("ExecuteWithParams1"); 
        Object result = operationBinding.execute(); 
        if (!operationBinding.getErrors().isEmpty()) { 
            return null; 
        } 
        return null; 
    } 
in the 'Tableselectone' component, which is where selects and a table does not have the Valuechangelistener property !!
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

: D

Next ...

Delete your bean method and then on this line in your JSP should accuse a mistake, then click on the red lamp your left in the direction of the line

Select all

valueChangeListener="#{backing_Montagem_transporte.Pesquisar_action}">
Create the method through the red lamp dai and just fill with what you have already done ... The method should receive this parameter 'valuechangeevent'
Thus being

Select all

 
public String pesquisarAction (ValueChangeEvent valueChangeEvent) {  
        BindingContainer bindings = getBindings();  
        OperationBinding operationBinding =  
            bindings.getOperationBinding("ExecuteWithParams1");  
        Object result = operationBinding.execute();  
        if (!operationBinding.getErrors().isEmpty()) {  
            return null;  
        }  
        return null;  
    }  
Note: Through the object 'valuechangeevent' that you receive by parameter, and possible to pick up the value selected in the combo, for example

Select all

 
String valorSelecionado = valueChangeEvent.getValue(); 
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

Look Victor ...

I did exactly the way you said ... but it gave the same ... he does as if he had updating the page ... but does not perform the action. ... !!

I even created another method in the Valuechangelistener property ... and then I put the code ... but did not give anything !! ..
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

Michele

As all good fishopath let's go by parts ...

"He does as if he had updated the page"
That's the partial rendered ... this is because of the autosubmit = 'true'
put a break point within your method that I am absolutely sure that it will enter your method .. o que is occurring and that your method is with problems

executewithparams1
Put a breakpoint in this method also

in the end your problem and your code o que I passed you is working
Anything put everything there q agent vê o que do
: Wink:
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

Well .. I put a breakpoint in my bean .. and he passed there ...

I will post my code:

Select all

 
<af:selectOneChoice value="#{bindings.wplaca.inputValue}" 
                                label="Selecione a O.S. do Transporte" 
                                autoSubmit="true" 
                                valueChangeListener="#{backing_Montagem_transporte.Pesquisar}"> 
              <f:selectItems value="#{bindings.wplaca.items}"/> 
            </af:selectOneChoice> 

Select all

 
    public void Pesquisar(ValueChangeEvent valueChangeEvent) { 
        // Add event code here... 
         BindingContainer bindings = getBindings(); 
         OperationBinding operationBinding =bindings.getOperationBinding("ExecuteWithParams1"); 
         Object result = operationBinding.execute(); 
 
    } 
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

so ...
as I said

the problem and logia of your
if you are entering the method and why you already understood how you do, now you need you take a look at your logic to hit her because the problem and that your method does not do what you think he had to do

: D
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

But when I call the method by the button ... it runs right ... he returns to the research ....

The only thing I did differently is to call this method in the valuechangelistener ....

are sure .. q I do not need to hit any more attribute? !!
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

Who returns right when you call in another form ...
The Method of AM or Bean ??

I think I know your problem

Select all

Object result = operationBinding.execute(); 
do so

Select all

 
operationBinding.execute();  
Object result = operationBinding.getResult(); 
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

I made this change ... but it did not help !! : Cry:

is the following .. I have a CommandButton:

Select all

 
<af:commandButton text="Pesquisar" 
                              disabled="#{!bindings.ExecuteWithParams1.enabled}" 
                              action="#{backing_Montagem_transporte.Pesquisa}"/> 

Select all

 
    public String Pesquisa() { 
        BindingContainer bindings = getBindings(); 
        OperationBinding operationBinding = 
            bindings.getOperationBinding("ExecuteWithParams1"); 
        Object result = operationBinding.execute(); 
        if (!operationBinding.getErrors().isEmpty()) { 
            return null; 
        } 
       return null; 
    } 

99] What I want is that he does the research only with the change of my selectonechoice .. without I need to have to click on the notion search ....
when I click on the Search button it works directly. ...

Selectonechoice code:

Select all

 
<af:selectOneChoice value="#{bindings.wplaca1.inputValue}" 
                                label="Placa" 
                                valueChangeListener="#{backing_Montagem_transporte.pesquisar_solicitacao}" 
                                autoSubmit="true"> 
              <f:selectItems value="#{bindings.wplaca1.items}"/> 
            </af:selectOneChoice> 

Select all

 
    public String pesquisar_solicitacao(ValueChangeEvent valueChangeEvent) { 
        // Add event code here... 
         BindingContainer bindings = getBindings(); 
         OperationBinding operationBinding = 
             bindings.getOperationBinding("ExecuteWithParams1"); 
         operationBinding.execute(); 
        Object result = operationBinding.getResult(); 
         if (!operationBinding.getErrors().isEmpty()) { 
             return null; 
         } 
         return null; 
    } 
I use this Even "executewithparams1" for both cases ... but in selectonechoice .. it is not showing the search ...
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

oh michele
I'm having a lot of trouble understanding your doubts always
separate the subjects better, create new topics, separate your doubts better, I know it is not easy when it is starting but I'm just talking so that I can help you in the best

let's do it ..
just do research with the selone is already all implemented ...

] now if you want to update another component that will be fed your search ... there is missing ..

in your component that has the valuechangelistener you will add
partialtriggers = "idoutrocomponent"

and the component that will be updated you will put
id = "idoutrocomponent"
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

Sorry ... I'll try to clarify my doubts better !! : Wink: hehe ...

... it's initially the doubt was a .. and so you're going to respond .. you will solve the doubt .. and others are appearing .. . But I will do my best, to separate things ...

Well .. I did what you gave me .. just otherwise the partialtrigger in the component that will be updated .. porque the way you passed me did not work ...

now he is doing the research .. but delayed ... let me explain:

Selectonechoice Incially has no value ... When I change his value the first time .. nothing happens .. already when I change the second time .. it does the research with the previous value ... and so successively .. it is always doing the research with the value that was selected before ...
I do not know if I was clear !! ...

I will pass the code:

Select all

 
<af:selectOneChoice value="#{bindings.wplaca1.inputValue}" 
                                label="Placa" 
                                valueChangeListener="#{backing_Montagem_transporte.pesquisar_solicitacao}" 
                                autoSubmit="true" id="placa_pesquisa"> 
              <f:selectItems value="#{bindings.wplaca1.items}"/> 
            </af:selectOneChoice> 

Select all

 
    public String pesquisar_solicitacao(ValueChangeEvent valueChangeEvent) { 
        // Add event code here... 
         BindingContainer bindings = getBindings(); 
         OperationBinding operationBinding = 
             bindings.getOperationBinding("ExecuteWithParams1"); 
         operationBinding.execute(); 
        Object result = operationBinding.getResult(); 
         if (!operationBinding.getErrors().isEmpty()) { 
             return null; 
         } 
         return null; 
Code of one of the components that will receive the research:

Select all

 
<af:panelLabelAndMessage label="Peso" 
                                               partialTriggers="placa_pesquisa"> 
                        <af:outputText value="#{bindings.FrotaSolicitacaoView1Peso.inputValue}" 
                                       inlineStyle="font-weight:bold;"/> 
                      </af:panelLabelAndMessage> 
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

I disturbed myself in the components in ... How good that you were able to solve
it's getting fierce huh ..

I understood what you're turning on .... I'vê never seen it: Roll:

Let me see your 'executewithparams1' .. post it there

a solution soon
and you get the method that is called it in your am and doing with it receives the direct parameter of the combo
how?!?!

Select all

 
Map params = operationBinding.getParamsMap(); 
params.put("nomeParam", (String)valueChangeEvent.getNewValue());  
named = to the name that you give the parameter in your Method Am
This guy will always have the new value altered in the combo

If your method does not still receive a parameter
you have to take it from the page definition of your jsp and also take from the client interface of your am .. dai put the param there, compile and do All over again Add to the Customer Interface and Page Definition
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

hehe .. sorry for my ignorance ... but I do not understand very well ;;;

But if the 'executewithparams' is not a method that I created ... where his code is ... you say that of the paidefinition?:

Select all

 
<action id="ExecuteWithParams1" IterBinding="FrotaSolicitacaoView1Iterator" 
            InstanceName="AppModuleDataControl.FrotaSolicitacaoView1" 
            DataControl="AppModuleDataControl" RequiresUpdateModel="true" 
            Action="95"> 
      <NamedData NDName="wplaca" NDType="java.lang.String" 
                 NDValue="${bindings.FrotaSolicitacaoView1_wplaca}"/> 
    </action> 
This code that you step We put where? ... in the bean? ...
then the "named" that you say ... would be my "wipla "As the code shows up there? ..
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

yes ... the code and in the bean getting like this ...

Select all

 
    public String pesquisar_solicitacao(ValueChangeEvent valueChangeEvent) {  
         BindingContainer bindings = getBindings();  
         OperationBinding operationBinding =  
         bindings.getOperationBinding("ExecuteWithParams1");  
 	 Map params = operationBinding.getParamsMap();  
         params.put("wplaca", (String)valueChangeEvent.getNewValue()); 	 
         operationBinding.execute();  
         Object result = operationBinding.getResult();  
         if (!operationBinding.getErrors().isEmpty()) {  
             return null;  
         }  
         return null;  
and in the page definition I think I will take the param 'ndvalue'
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

Hi Victor ... I think my valuechangeevent .. is with some problem .. because when I locked for a fixed value it works normal ... the research ...:

Select all

 
params.put("wplaca", "AAA1231");  
But when I put it like this:

Select all

 
params.put("wplaca", (String)valueChangeEvent.getNewValue());  
He did nothing ...

] * .. ahh .. and I took the ndvalue ... from the pageedefinition ..
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

It is wrong yes ... the signature of the method

must be returning void and not string

now work: lol:
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

:(

I do not work ... now it simply does not show any value !! ...
:!:
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

The section is beautiful but there are some bugs: lol:

does the process again ... erases everything and start again

If it does not work Try to make a use case only to test the functionality

see what you can and me of news
Mick
Rank: Programador Sênior
Rank: Programador Sênior
Posts: 69
Joined: Fri, 08 Feb 2008 11:20 am
Location: São Paulo - SP

hehe ...

I'll try ... if I have some progress ;; I post !!
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests