You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Charles Mason <ch...@gmail.com> on 2008/12/04 13:04:42 UTC

Partial Event Bubbling from Component to Page

Hi All,

I have a problem which I wondering how best to solve. Basically I have
several pages all with a grid of data on them and under that a custom
component which is common to all these pages. The custom component has
a load of user input components and two buttons a save and a discard
changes button. Basically when the save one is clicked all the user
data is persisted from the session to a DB via Hibernate and when
discard is clicked all the session data is reloaded from the DB.

My problem is one page has something else on it the user can edit so I
need to let the page hook when the save event is triggered. I read
about event bubbling which seems to be what I want although I can't
seem to make it work. I have the components onSelectedFromSave method
return false, but the pages onSelectedFromSave method never gets
called unless I comment out the one in the component. I have I miss
understood something about event bubbling.

Incidentally the pages component sends its changes back via AJAX so
there's no actual form on the page, just in the component, is this
part of my problem?

Anyone have any suggestions ?

Charlie M

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: Partial Event Bubbling from Component to Page

Posted by "Joost Schouten (mailing lists)" <jo...@jsportal.com>.
I think the event you want to handle is the EventConstants.SUCCESS on
the Form component, the onSelectedFromSave is just a way to capture
what button in your form has been clicked if I'm not mistaken. Try the
following methods in both your component and see if they bubble

@OnEvent(value = EventConstants.SUCCESS)
private void myComponentMethod() {
    //do something
}

@OnEvent(value = EventConstants.SUCCESS)
private void myPageMethod() {
    //do something more
}

I hope this helps,
Joost

On Thu, Dec 4, 2008 at 5:34 PM, Charles Mason <ch...@gmail.com> wrote:
>
> Hi All,
>
> I have a problem which I wondering how best to solve. Basically I have
> several pages all with a grid of data on them and under that a custom
> component which is common to all these pages. The custom component has
> a load of user input components and two buttons a save and a discard
> changes button. Basically when the save one is clicked all the user
> data is persisted from the session to a DB via Hibernate and when
> discard is clicked all the session data is reloaded from the DB.
>
> My problem is one page has something else on it the user can edit so I
> need to let the page hook when the save event is triggered. I read
> about event bubbling which seems to be what I want although I can't
> seem to make it work. I have the components onSelectedFromSave method
> return false, but the pages onSelectedFromSave method never gets
> called unless I comment out the one in the component. I have I miss
> understood something about event bubbling.
>
> Incidentally the pages component sends its changes back via AJAX so
> there's no actual form on the page, just in the component, is this
> part of my problem?
>
> Anyone have any suggestions ?
>
> Charlie M
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org