• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: WOActionURL and AJAX
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WOActionURL and AJAX


  • Subject: Re: WOActionURL and AJAX
  • From: Mike Schrag <email@hidden>
  • Date: Tue, 23 Jan 2007 16:23:57 -0500

AjaxUpdateContainer doesn't exactly work that way ... Well, if you're pointing to a direct action and the action only generates direct action links inside of it, then you CAN use it that way (i.e. replace an arbitrary div with the results of an action -- more the "traditional" ajax approach), but if you're intending on having component actions in the result, then you need to use it he "proper way". The fundamental problem is that if you are generating content in response to an Ajax request, and it that content has a component action in it, it HAS to fit into the page structure properly so that your page cache is in an internally consistent state at all times (even if you're only updating one piece of it). WO passes bindings up and down the tree of elements, so if you just arbitrarily dump a component action into the middle of some other component's content, it will be out of order when you execute the NEXT request, and WO won't be able to find it.

The "proper way" is that you wrap the areas that will be updating in an AjaxUpdateContainer and use AjaxUpdateLinks to trigger their refresh. AjaxUpdateLink has an action binding on it, so you can bind it to an arbitrary component action and also give it an updateContainerID that is the ID update container on the page to refresh. It works a little differently than normal actions in WO, in that in a normal WO action, your action method returns the page to go to next. In Ajax actions, you generally don't use that feature, because the assumption is that you are refreshing part of an already loaded page. So instead, your action returns null, and you trigger an area of the page to refresh as a result of your action (remaining on the same page). When the refresh occurs, your page will be in the new state following the action, so it will just refresh the one section properly.

So if you're comparing it to how, say, Rails uses Ajax, you think very different. However, once you start thinking the WO Ajax way, it's actually a lot more powerful because you have the full stateful WO component/page model backing your Ajax requests. You can do some really slick stuff that would be very hard to do most of the other web frameworks. It's really hard to write about, but actually pretty easy to use. I recommend you download and run the AjaxExample application in Wonder. It covers a bunch of crazy example cases of things people commonly want to be able to do.

ms

On Jan 23, 2007, at 2:59 PM, Thierry Kramis wrote:

Is there any way to use WOActionURL with the Project Wonder AJAX Framework
so that you only might reload an AJAXUpdateContainer with that link? We
actually make heavy use of this component and can't replace it with let's
say a hyperlink or so.


Any suggestions?


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40mdimension.com


This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >WOActionURL and AJAX (From: Thierry Kramis <email@hidden>)

  • Prev by Date: WOActionURL and AJAX
  • Next by Date: XCode build command for XCode 2.2 and above
  • Previous by thread: WOActionURL and AJAX
  • Next by thread: XCode build command for XCode 2.2 and above
  • Index(es):
    • Date
    • Thread