The correct way to render a datagridfield in a view

Hi everyone,

I have a problem rendering a datagridfield in my view. With my limited knowledge, I cannot find a way to render it directly in a view as readonly, although I can use it smoothly in the edit form. I am using the latest version of it 1.5.3.

I appreciate so much your help as it is taking a 2 days now without finding a correct way to render it.

I am using plone 1.5.6
I am referring to this page Fields and widgets — Plone Documentation v5.2
but it does not help.



Usually you have field definition like

    contact_keywords_en = schema.List(
        title=_("Contact keywords EN"),
            "Keywords for contact portlets in EN. One (short) item per line!"
        value_type=DictRow(title=_(u"Keywords"), schema=IKeywordRow),

In our case, we have one col per per row:

class IKeywordRow(model.Schema):

    keyword = schema.TextLine(title=_(u"Keyword"), required=True)

So context.contact_keywords_en is a list of Python dicts where each dict has one key-value pair keyword.


  <li tal:repeat="d context/contact_keywords_en">
    <span tal:content="d/keyword"/>

This helped a lot. It is simpler than I thought. it is working perfect.
Thanks so much

1 Like