= Ajax Grid Widget= This documentation is from Steve Bergman's post in [http://groups.google.com/group/turbogears/browse_thread/thread/fb6c3611b49af727/3d4d4ad72610b638#3d4d4ad72610b638 group] Using ajaxgrid is really quite simple. For future first-timers like me, here is an easy example which works with TG 0.9a4: == 1. Quick start a project == == 2. Edit controllers.py == Edit controllers.py to look like the following: {{{ #!python import cherrypy import turbogears from turbogears import controllers, expose, redirect from turbogears import identity from turbogears.widgets import AjaxGrid from datetime import datetime grid = AjaxGrid(refresh_url="/search", defaults=dict(q='turbogears')) class Root(controllers.RootController): @expose(template=".templates.form") def index(self): return dict(form=grid) @expose(format="json") def search(self, q): # Fake a row of results date = datetime.today() hour = date.strftime('%H') minute = date.strftime('%M') second = date.strftime('%S') return dict( headers = ["Hour", "Minute", "Second"], rows = [[hour, minute, second]], ) }}} == 3. Create the template == Create the template "form.kid" and make it look like this: {{{ Ajaxgrid Example }}} == 4. Try it out == Start your project and try it out. You should get a single row with the current hour, minute, and second. It should update when you click 'Update'.