Re: Subcomponent Refresh
Re: Subcomponent Refresh
- Subject: Re: Subcomponent Refresh
- From: Jonathan Rochkind <email@hidden>
- Date: Mon, 23 Feb 2004 13:09:33 -0600
The proper way to communicate to subcomponents is almost always
through bindings.
I would add a binding to the subComponent, boolean value, called
'shouldRefresh'.
Over-ride the sub-component's appendToResponse, to refresh if the
binding is true, before calling super.appendToResponse. Pass 'true'
to the subcomponent when you want it to refresh.
Alternately, if you want the subcomponent to _always_ refresh before
displaying it's HTML, you could dispense with the binding, and just
always refresh in appendToResponse before calling
super.appendToResponse.
Another alternate idea: Pass the actual -data- to the subcomponent
through bindings. When the parent wants to refresh the data, it can
simply refresh the data itself, and pass that new data in through the
bindings. It doesn't sound like that's convenient in your case
though.
Hope this helps,
--Jonathan
At 7:47 PM +0100 2/23/04, David Griffith wrote:
Hi all,
I have a subcomponent whose purpose is to display a list of objects.
I have a main page containing that subcomponent.
On the main page, you can click a link that will effectively add an item to
the database (which is now also to be displayed in the list in the
subcomponent).
The subcomponent gets its data from the database and it works fine except
that when I return 'null' to the main page to refresh it, the subcomponent
does not update the list. I guess this makes sense as it hasn't been told
to refetch from the database, so I need it to be able to do this.
Is there some way to indicate to a subcomponent that it's parent has
refreshed, or is there a way to execute a method in the subcomponent whe it
refreshes?
Regards,
Dave.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.