Web2py table understanding why the table title?
I really don't get why is the TABLENAME.TABLEFIELD is displayed when u loop trough a table how does this work ? and most off all can i make it not display ?
Example :
cars.car <----tableNAME.tableID
szxcz <----first row asdasdas zfsdfsdf fsdsdewewe wrythfghfghfg <----last rowAny explication will help ...
When u try to display a SQLTABLE via a view u get开发者_如何转开发 the name of the table and the id of the table in a "header" . Example : The contoler :def index():
something = db(db.database_table.database_id).select()
return dict(something=something)
The view :
{{extend 'layout.html'}}
<p>Table</p>
{{=something}}
And the display would look like this :
cars.car <----tableNAME.tableID<br />
szxcz <----first row<br />
asdasdas<br />
zfsdfsdf<br />
fsdsdewewe<br />
wrythfghfghfg <----last row<br />
Any way i fond it : SQLTABLE(...,headers=None) or to the example above something=SQLTABLE(....,headers=None)
When you do this, {{=somthing}}, you are using the default to display the table contained in 'something'. The default displays the field names at the top of the table.
If you do not want this, you have to replace the default display in the view and explicitly display the parts of the table you want to see.
Something like this:
<table>
{{for row in something:}}
<tr>
<td>>
{{=row.nameoffield1}}
</td><td>
{{=row.nameoffield2}}
</td>
...
</tr>
{{pass}}
</table>
精彩评论