Sorry Anthony, I should've been more specific... Wasn't related to your
example, that's why I replied to the original message.
I was just showing the way to format the data, even with the grid as is,
without replacing the whole format.
On Saturday, September 21, 2013 5:51:49 PM UTC-4, Anthony wrote:
>
> Sorry, not sure I follow. What does this have to do with the following
> code:
>
> mydisplay = myformat(grid.rows)
> grid.element('.web2py_table', replace=mydisplay)
>
> The above should replace the entire grid table (which means the "links"
> argument would be useless, as it is used to add elements to the grid).
>
> Anthony
>
> On Saturday, September 21, 2013 5:46:26 PM UTC-4, Adi wrote:
>>
>>
>> I'm formatting the data for certain columns within each row by calling a
>> function, and returning an XML element, which then displays HTML within
>> that cell. Code bellow is just to give you an idea...
>>
>> GRID:
>> links=dict(orderMaster=[
>> lambda row:(_get_order_address(row)),
>> ])
>>
>>
>>
>> def _get_order_address(row):
>>
>> order=db(Order.id==row.id).select(cache=(cache.ram,60),
>> cacheable=True,
>> ).first()
>>
>> t = XML('<strong>Customer:</strong><br/>' +
>> (order.shipFirstName.capitalize() + ' ' if order.shipFirstName
>> else '') +
>> (order.shipLastName.capitalize() + '<br/>' if order.shipLastName
>> else '') +
>> (order.shipAddress1 + '<br/>' if order.shipAddress1 else '') +
>> (order.shipAddress2 + '<br/>' if order.shipAddress2 else '') +
>> (order.shipCity + ' ' if order.shipCity else '') +
>> (order.shipPC + ', ' if order.shipPC else '') +
>> (order.shipProvince + '<br/>' if order.shipProvince else '') +
>> (order.shipCountry + '<br/>' if order.shipCountry else '')
>> )
>>
>> return t
>>
>>
>>
>>
>>
>>
>>
>> On Saturday, September 21, 2013 2:43:34 PM UTC-4, ssuresh wrote:
>>>
>>> The problem is that my data does not display too well in a table grid.
>>> Some of my columns are descriptions that do not fit well inside a grid. So
>>> I want to display it in a more readable alternate formats. - Something like
>>>
>>> ------------------------------------
>>> *Title *
>>> description ......
>>>
>>> *date*
>>> -------------------------------------------
>>>
>>> I used sqlform.grid because i want to make use of its other features
>>> like automatic add/del/edits and search/export functionalities.
>>>
>>> So do you have any suggestions for that?
>>>
>>>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.