On 1/13/06, Simon Kitching <[EMAIL PROTECTED]> wrote:
> On Fri, 2006-01-13 at 17:22 -0500, Ryan Wynn wrote:
> > Can anyone explain to me how a link inside extendedDataTable whose
> > action is bound to a rowVar bean method gets executed?  I have a case
> > where I invoke a method binding on the rowVar bean in the table.  When
> > I click on the link the method is executed but not on the correct
> > row/bean in the table.  My problem began where I started sorting the
> > list return to data in the getData method.  I guess my sorting of the
> > list is not being propogated to the list data model.  The rows appear
> > in the order that is expected.  It is just invoking the link on the
> > correct bean in the unwind process that is not working.  I am using
> > myfaces 1.1.1.  Other things to note, the link isImmediate is true (I
> > also tried false) and FacesContext.renderResponse is called first in
> > the invoked method.  The invoked method also returns null because I
> > want to stay on the same view.
>
> There is a hidden field in each form that is used to store the id of the
> command component that caused the form to be submitted.
>
> Each command component (commandLink, commandButton, etc) has javascript
> attached to it which sets this hidden field to the command component's
> id before performing the submit.
>
> In the case of a commandLink in a table, the javascript rendered for
> each row will set this hidden field to a slightly different value (ie
> indicating the row).
>
> After a submit occurs, the table does:
> for each row:
>   set row index
>   call decode for each child component
>
> Therefore on each row the commandLink component looks for its id in the
> hidden field - but this is only found when table rowIndex matches the
> one that the user clicked on. When this occurs, the commandLink
> component queues an event for later processing; this is intercepted by
> the UIData component which wraps it in a custom event class that knows
> about the current row.
>
> When the event is executed, the custom event class ensures the UIData's
> rowIndex is set to the appropriate row for the event before the
> ActionListeners attached to the commandLink component are run. Result:
> the code run by the ActionListeners can look at the parent table, and
> see its rowIndex and rowData objects are set to the appropriate values
> for the row containing the link that was clicked on.
>
> All this *does work*; I use it - and with sorting enabled too.
>
> Perhaps you're correctly sorting at the render phase, but are returning
> the data in a different order during the "decode" phase?
>
> Regards,
>
> Simon
>
>

Thanks, Simon.  The whole unwinding a form process is pretty
interesting.  I was able to fix my problem.  I think you were correct
about the render vs. decode phase.
I added some code to ensure that both were in synch. The final result
is a tree-table based on extendedDataTable that sorts tree peers.

Reply via email to