How can i use nested nevow:data construction? <div n:data="items"> ... <div n:data="subitems"> </div> </div> this construction won't working at all... For example, first data is array of years ('1997', '1998', e.t.c) and second data is "select * from .. where year=%s" And i whant a page with many tables - one table, one year So i desided to make nested n:data tags: <div n:data="years" n:render="years"> <div n:pattern="year"> <table> <div n:data="year" n:render="year" > <div n:pattern="item"> tr td td td </div> </div> </div> But it doesn't work Any solution?
On May 8, 2005, at 4:18 AM, Little wrote:
How can i use nested nevow:data construction?
The next data is always looked up in the current data. At the top
level, the current data is the page you're rendering, with its data_
methods. As you saw, when you nest one inside another, the current
data when looking up the inner data is the outer data, rather than
the page.
A workaround is to use a renderer instead of a data directive. I
believe something like this should work:
def render_getyeardata(self, ctx, data):
d = runQuery("select * from ... where year="%s")
def rememberIt(result):
ctx.remember(result, inevow.IData)
return ctx.tag
d.addCallback(rememberIt)
return d
Then in your page,
<div n:data="years" n:render="years">
<div n:pattern="year">
<table>
participants (2)
-
James Y Knight
-
Little