Hi,
I'm using Turbogears2 and trying to create a simple FlexiGrid from
this tutorial:
http://turbogears.org/2.0/docs/main/ToscaWidgets/Cookbook/FlexiGrid.html
The grid displays with proper data. However, for some reason, i get
two grids , one inside the other and distorted.
Am i missing something trivial here?
Thanks.
I'm using this code:
root.py
from tw.jquery import FlexiGrid
@expose('templates.index')
def index(self):
colModel = [
{'display':'ID', 'name':'id', 'width':20,
'align':'center'},
{'display':'Title', 'name':'title', 'width':80,
'align':'left'},
]
grid = FlexiGrid(id='flex', fetchURL='fetch', title='Movies',
colModel=colModel, useRp=True, rp=10,
sortname='title', sortorder='asc', usepager=True,
showTableToggleButton=True,
width=500,
height=200
)
pylons.c.grid = grid
return dict()
@expose('json')
def fetch(self, page=1, rp=25, sortname='title', sortorder='asc',
qtype=None, query=None):
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)
rows = [{'id' : movie.id,
'cell': [movie.id, movie.title]} for movie in movies]
return dict(page=page, total=total, rows=rows)
------------------------------------------------------------------------------------------------------------------
index.html
${tmpl_context.grid()}
--
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.