I am trying to develop a prototype and am having trouble with the
Flexigrid widget. It sounds great. I seem to be missing something in
using the templetes or ???
Here is the code from the tutorial:
-----------------------------------------------------------------------------------------
Once the Widget is instantiated it can be served up to the user from
the controller:
@expose('samplegrid.templates.index')
def index(self):
pylons.c.grid = grid
return dict()
The widget can be displayed in the template by:
${tmpl_context.grid(value=value)}
@expose('json')
def fetch(self, page=1, rp=25, sortname='title', sortorder='asc',
qtype=None, query=None):
offset = (page-1) * rp
if (query):
d = {qtype:query}
movies = DBSession.query(Movie).filter_by(**d)
else:
movies = DBSession.query(Movie)
total = movies.count()
column = getattr(Movie.c, sortname)
movies = movies.order_by(getattr(column,sortorder)()).offset
(offset).limit(rp)
rows = [{'id' : movie.id,
'cell': [movie.id, movie.title, movie.description,
movie.year, movie.genera]} for movie in movies]
return dict(page=page, total=total, rows=rows)
--------------------------------------------------------------------------------
The error is " value is undifined "
I think that means 'value' is empty, has no contents. What needs to be
sent to the template?
Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" 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?hl=en
-~----------~----~----~----~------~----~------~--~---