-
1. Re: could not send attribute via a4j:support in extendedDataTable
h2g2 Oct 5, 2011 8:45 AM (in response to satyakatti)I may be wrong but I think the actionListener is invoked in a phase that happens before the UPDATE_MODEL_VALUES one, and thus the object is not set yet.... the problem is that it would not explain why it is set when you set it as a string...
Then, in order to ensure it is right, you can try to retrieve "by force" from the listener , eg that way :
(String)event.getComponent().getAttributes().get("load");
If you can't get it that way, you could also try to postpone the event in order to manage it at a later phase (see below for an example), or eventually use an action instead of an action listener.
Example with the postpone method :
public final void valueChangeListener(final ValueChangeEvent event) { final PhaseId phaseId = event.getPhaseId(); if (phaseId.equals(PhaseId.ANY_PHASE)) { event.setPhaseId(PhaseId.UPDATE_MODEL_VALUES); event.queue(); } else if (phaseId.equals(PhaseId.UPDATE_MODEL_VALUES)) { final Object object=event.getNewValue(); ... etc. } }
Alternatively, you could try using a <f:SetPropertyListener> instead of an <f:attribute>
That way actually :
<f:setPropertyActionListener value="#{testStep}" target="#{testplannerBean.currentItem}" />
Hope this will help you find your problem
-
2. Re: could not send attribute via a4j:support in extendedDataTable
satyakatti Oct 5, 2011 10:12 AM (in response to h2g2)No..That didnt work.
I replaced f:attribute with something like :
<f:setPropertyActionListener value="#{teststep}" target="#{testplannerBean.selectedTestStep}"/>
It goes to setter method but the teststep is still null. Hope there is otehr way to do this
-
3. Re: could not send attribute via a4j:support in extendedDataTable
h2g2 Oct 5, 2011 12:55 PM (in response to satyakatti)I tried the same in some piece of code I have running a rich:DataTable.
I don't know if it is also suited to the extended version, but this may work:
<rich:dataTable ... > <a4j:support event="onRowDblClick" action="#{myBean.testRowDblClick}"> <f:setPropertyActionListener value="#{varTest}" target="#{myBean.currentItem}" /> </a4j:support> ... </rich:dataTable>
I tried first with an action event and a ondblclick event but this did not work (null object like you).
I then replaced the actionEvent with an action, but this just did not trigger the action. Then I changed from ondblclick to onRowDblClick and this eventually worked (currentItem was always ok).
Hope this will do it now!