I suppose it depends how much customization you require. If you just need 
to customize the display of individual fields, you can use the "represent" 
attribute of each DAL Field. If you need to suppress particular fields, you 
can set their "readable" attribute to False. If you need to include 
additional columns that are not based on the value of just a single field, 
then you can use the "links" argument to .grid() -- it can be a list of 
dictionaries of the form:

{'header': '[column heading]', 'body': [callable object that takes a Row asinput
]}

Finally, the object returned by .grid() includes a "rows" attribute that 
holds the DAL Rows object used to construct the grid. You can use that to 
create your own table or other display and then replace the standard grid 
table:

grid = SQLFORM.grid(db.mytable, ...)
mydisplay = make_grid_display(grid.rows)
grid.element('.web2py_table', replace=mydisplay)

'web2py_table' is the class of the div that holds the standard grid table. 
The above identifies that div within the grid DOM and replaces it with an 
alternative display.

Anthony

On Wednesday, May 15, 2013 6:36:53 AM UTC-4, Vlasov Vitaly wrote:
>
> Hello all! I need help about SQLFORM.grid
>
> I need to represent data from DB in my own way. I choose SQLFORM.grid() 
> for that task. Returned form is displayed as table of lines with fields 
> values. In my app  need to specify how every db record will be displayed.
>
> How to specify my own widget to display every db record in SQLFORM.grid?
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to