Hi:

I made a prototype widget that did the basic AJAX
request/response/replace process.

Take tg-admin quickstart 'welcome' page for example, to get server time
asynchronously:

1. In "welcome.kid", User add a link in "timelink" zone,
and provide a "timediv" zone for later replacement

<span py:replace="now">now</span>
+ <div id="timelink"><a href = "/time">get time</a></div>
+ <div id="timediv"></div>

the above link '/time' is workable. (add a new method 'time' which
"return time.ctime()" in controllers.py )

2. In "welcome.kid",  Add a line to bind the ajax call:

<title>Welcome to TurboGears</title>
+ ${RemoteLink.display(target = "timelink", update="timediv",
href="/time", action="showTimeDiv")}
</head>

The RemoteLink did 3 things:

  * connect 'timelink' div with the js function.
  * fire a XMLHTTPRequest to "/time" and get the response
  * autocreate a 'showTimeDiv' function to update the 'timediv' div.


The widget is inspired by IBM 'AJAX with Rails' and TG 'wiki/page6'
docs.
I think its a cool feature that really encourage the basic AJAX usage
in TurboGears.


Due to my lack of JS experience, I'd like to toss the source and see if
there are more widgets to do those "link_to_remote"-like thiings
http://paste.turbogears.org/paste/819

(some other rails helper list here
http://www.rubyonrails.org/api/classes/ActionView/Helpers/PrototypeHelper.html)


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"TurboGears Trunk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to