t2.itemize builds the table and TR and asks the table's represent(r) to fill in the rest. So the following creates a simple TD for each field.
db.mytable.represent=lambda r: [TD(r[name]) for name in db.mytable.fields] You could make it more sophisticated by adding attributes to the TD that would allow styling via css. On Dec 6, 9:16 pm, "Wes James" <[EMAIL PROTECTED]> wrote: > Then you might need to take the form and get your own pieces out. > This is from a former post from Massimo: > -------------------------------------------------------------------------- > You can navigate the form is you want... > > form[0] is the table > form[0][0] is the first row of the table > form[0][0][1] is the second column of the first row > form[0][0][1][0] is the input in the second columnt of the first row > form[0][0][1][0]['_id'] is the '_id' attribute of that input, etc etc > etc > > But this old stuff. Documented in the manual. You also reassign, > append and delete elements from the form. > > form.append(DIV(INPUT(_name='hello')) > > Massimo > ------------------------------------------------------------------------------- > > On Sat, Dec 6, 2008 at 2:02 PM, Julius Minka <[EMAIL PROTECTED]> wrote: > > > I would like to do that, but the code below is generated by t2's > > itemize... > > > On So, 2008-12-06 at 13:55 -0700, Wes James wrote: > >> put each col in its own td > > >> On Sat, Dec 6, 2008 at 1:51 PM, Julius Minka <[EMAIL PROTECTED]> wrote: > > >> > You are right, but DIV makes new line. That is not what I want. I need > >> > all values of a record to stay on the same line. > > >> > Width property could be theoretically placed on TD, but as you can see > > >> > <table class="t2-itemize"><tr><td></td></tr><tr><td><div><span > >> > class="col1"><a href="/f7/default/display_ware/1">12345</a></span><span > >> > class="col2">gfhhjj</span></div></td></tr><tr><td></td></tr></table> > > >> > both values (12345 and gfhhjj) are in one cell, so I am stuck again. > > >> > Julius > > >> > On So, 2008-12-06 at 13:24 -0700, Wes James wrote: > >> >> probably because span does not have a width. > > >> >>http://www.w3schools.com/TAGS/tag_span.asp > > >> >> you need to use an element that uses width like div > > >> >> try this: > > >> >> <html> > >> >> <head> > >> >> <title> > >> >> test > >> >> </title> > >> >> </head> > > >> >> <body> > >> >> <span style="color:#555555; background:cccccc; width:50px;">line > >> >> 1</span><br> > >> >> <span style="color:#777777; background:cccccc; width:150px;">line > >> >> 1</span> > >> >> <table> > >> >> <div style="color:#555555; background:cccccc; width:50px;">line 1</div> > >> >> <div style="color:#777777; background:cccccc; width:150px;">line 1</div> > > >> >> </body> > >> >> </html> > > >> >> -wj > > >> >> On Sat, Dec 6, 2008 at 12:47 PM, Julius Minka <[EMAIL PROTECTED]> wrote: > > >> >> > thanks for advice, I corrected it down to > > >> >> > SPAN.col1 { width: 200px; background-color: #aaa; } > > >> >> > Background color is applied, but width is not. > >> >> > I can't see why. Any hint? > > >> >> > Julius > > >> >> > On So, 2008-12-06 at 12:58 -0600, Yarko Tymciurak wrote: > >> >> >> look for typos; look at output with firebug / firefox to try to > >> >> >> find hints. > > >> >> >> On Sat, Dec 6, 2008 at 10:27 AM, Julius Minka <[EMAIL PROTECTED]> > >> >> >> wrote: > > >> >> >> Thanks, this is the solution I need, > >> >> >> except > >> >> >> the two CSS lines are not applied to those elements of row. > > >> >> >> I added > >> >> >> SPAN .col1 {width: 200px} > >> >> >> SPAN .col2 {width: 200px} > > >> >> >> to the end of static/styles.css > >> >> >> What's wrong? > >> >> >> Julius > > >> >> >> On So, 2008-12-06 at 07:33 -0800, mdipierro wrote: > >> >> >> > You cannot format it like a table but you can > > >> >> >> > represent=lambda r: DIV(SPAN(r.field1,_class="col1"),SPAN > >> >> >> > (r.field2,_class="col2")) > > >> >> >> > and in css > > >> >> >> > SPAN .col1 {width: 200px} > >> >> >> > SPAN .col1 {width: 200px} > > >> >> >> > Massimo > > >> >> >> > On Dec 6, 8:26 am, billf <[EMAIL PROTECTED]> > >> >> >> wrote: > >> >> >> > > If you look at the default represent() in t2.py you can > >> >> >> see how to do > >> >> >> > > whatever you want. Maybe the default is what you want(?) > > >> >> >> > > On Dec 6, 2:09 pm, Julius Minka <[EMAIL PROTECTED]> > >> >> >> wrote: > > >> >> >> > > > yes, I know. > >> >> >> > > > I do it this way: > > >> >> >> > > > db.puppy.represent=lambda row: \ > > >> >> >> > >> >> >> P(A(row.name,_href=t2.action('display_puppy',[row.id])),SPAN(row.age)) > > >> >> >> > > > The only trouble is, that it is not formattted like a > >> >> >> table: > >> >> >> > > > dog1 > >> >> >> > > > doggie2 > > >> >> >> > > > I need > >> >> >> > > > dog 1 > >> >> >> > > > doggiw 2 > > >> >> >> > > > Julius > > >> >> >> > > > On So, 2008-12-06 at 05:35 -0800, billf wrote: > > >> >> >> > > > > are you using t2? The t2 manual describes doing this > >> >> >> by > > >> >> >> > > > > db.mytable.represent=lambda row: '%s %s' % > >> >> >> (row.myfield,row.id) > > >> >> >> > > > > which I have used and it works fine. > > >> >> >> > > > > On Dec 6, 10:08 am, Julius Minka <[EMAIL PROTECTED]> > >> >> >> wrote: > >> >> >> > > > > > How can I format itemize output to a table (regular > >> >> >> structure of > >> >> >> > > > > > columns)? I am showing more columns on the line. > >> >> >> > > > > > Something similar to default view for records... > >> >> >> > > > > > Thanks > >> >> >> > > > > > Julius --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" 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/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

