[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
RISC: t:fixgrid The onRowSelect() is triggered after the actionListener of t:checkbox if using mouse  XML
Forum Index -> Development
Author Message
zoteszari

Active

Joined: 04/12/2017 09:47:01
Messages: 8
Offline

Hi Captain,
I'm trying to change a value on a row when the user select a checkbox on that row. For that I'm using a t:checkbox with flush and when the selection in the grid is done by keyboard everything is ok: when the user press UP/DOWN the onRowSelect() is triggered and I save the item as selectedItem and I use that in the actionListener of the checkbox to change the value on the current(selected) row.
But when the user goes directly on a new row and select the checkbox with a mouse click the actionListener of the checkbox is executed first and the onRowSelect() after, so I no longer have the correct selectedItem! If I first select the row with a mouse click on another column(not the checkbox one) the onRowSelect() is triggered and if after that I select the checkbox everything is ok.

Is this a bug ? Or I have to do this another way ?
Thanks,
Zoltan
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5526
Offline

Hmmm,

I see no problem from components' point of view in your description. You select the checkbox => the action listener is fired due to flush, you select a row => the onRowSelect is fired. There is a certain sequence (which is driven by the component hierarchy), but there must be a sequence! ;-)

Maybe it helps if you know that the selection information (i.e. the information which item is selected in a grid) is passed in the value-transfer-phase of the request processing, which is ended before the actions are invoked.

So in all action listeners you can be sure about, that the selection information is correct and updated.

Reagrds, Björn

Björn Müller, CaptainCasa GmbH
zoteszari

Active

Joined: 04/12/2017 09:47:01
Messages: 8
Offline

Hi Captain,

I thought that because we change the row onRowSelect will be triggered first.
If I understand corectly the "...the selection information (i.e. the information which item is selected in a grid) is passed in the value-transfer-phase of the request processing..." I have to do something like this:

<t:beanprocessing >
<t:beanmethodinvoker actionListener="#{d.myUI.onUpdateGrid}" jsfphase="updateEnd" />
</t:beanprocessing>

Unfortunately this is triggered after the actionListener of the checkbox and the onRowSelect.
I tried with jsfphase="updateBegin" and now is triggered before the actionListener of the checkbox but the m_grid.getSelectedItem() is null!

I'm stuck! Any idea of what I'm doing wrong ?

Thanks,
Zoltan
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5526
Offline

Hi Zoltan,

to be honest I do not 100% follow your scenario description...

Seems to me that the CHECKBOX in your case is used as a trigger to do something. And at the same time the value of the CHECKBOX is somehow linked to an item selection. (?)

If you want to trigger things, then maybe the CHECKBOX is not really the control you should use. Select an ICON/BUTTON to trigger things and use the IMAGE of the ICON/BUTTON to represent the state of what you want to display.

Maybe add some simple JSP/Java to better explain. ;-)

Thanks! Björn

Björn Müller, CaptainCasa GmbH
zoteszari

Active

Joined: 04/12/2017 09:47:01
Messages: 8
Offline

Hi Captain,

I found what I was doing wrong. In my grid I had:
<t:checkbox flush='true' selected='.{selected}' actionListener='#{d.MyUI.onCheckboxFlush}' />
and instead I should have
<t:checkbox flush='true' selected='.{selected}' actionListener='.{onCheckboxFlush}' />

Copy/Paste from one class to another...
Sorry for this.
Now it is working fine.

The only question I have left is regarding this:
<t:beanprocessing >
<t:beanmethodinvoker actionListener="#{d.myUI.onUpdateGrid}" jsfphase="updateEnd" />
</t:beanprocessing>

onUpdateGrid from this example is invoked before or after the actions are invoked ? Because I see that it is invoked after the onCheckboxFlush and onRowSelect and I understood from what you said earlier that it is invoked before them. I'm wrong ? Maybe is not the correct name for the jsfphase that I use ?
Thanks for your patience.

Zoltan
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5526
Offline

Hi,

the sequence is as follows:

1. Update value phase

A. all set-ters of changed properties are called. The sequence is NOT corresponding to the sequence of the data input on front end side, but is driven by the sequence in the component tree!

B. all FLUSH-ActionListeners are called (well normally it's exactly one)

C. if defined: BEANPROCESSING-ACTIONLISTENERS with phase "updateEnd" are called

2. Invoke phase

A. all "normal" action listeners are called. Normally exactly one.



Why are the actionListeners of the Flush-Events called in the update phase? - Reason: we decide that first the data-driven actions are executed, and then the event-driven actions.
Example: the flush is not triggered by the user tabbing outside the field, but by the user keying some hotkey ("F11", e.g. hotkey behind a button) which is bound to an actionListener.

In this case the F11-actionListener should always run after the Flush-actionListener - independent from the arrangement of the components in the component tree.


Hope, my answers constantly come closer to what your are asking! ;-)

Regards, Björn

Björn Müller, CaptainCasa GmbH
zoteszari

Active

Joined: 04/12/2017 09:47:01
Messages: 8
Offline

Hi Björn,

In understand now. Thanks for your detailed answer.

Zoltan
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team