[Grok-dev] Using z3c.table in a grok view?
Adam Summers
adamsummers1 at mac.com
Fri Jun 6 09:51:51 EDT 2008
Hi Tim,
Thanks for that :)
Got it working simply, the column definition and the view are as
follows:
class AmtColumn(column.GetAttrColumn, grok.MultiAdapter):
grok.name('amtCol')
grok.adapts(gehar, IDefaultBrowserLayer, table.interfaces.ITable)
grok.provides(table.interfaces.IColumn)
header = u'Amount'
attrName = 'amount'
weight = 1
class Index(grok.View, table.Table):
grok.context(gehar)
update = table.Table.update
def render(self): #to overload grok.View.render(), but we need to
make sure the index.pt isn't closely associated with the View.
template = grok.PageTemplateFile('special_template/index.spt')
return template.render(self)
Thanks and Regards,
Adam
On 02/06/2008, at 2:16 PM, Tim Terlegård wrote:
> On Jun 1, 2008, at 3:46 PM, Adam Summers wrote:
>>
>> I have in my code the following -- can someone see what I'm doing
>> wrong?
>>
>> from z3c.table import table, column
>>
>> class NameColumn(column.GetAttrColumn, grok.MultiAdapter):
>> grok.name('nameCol')
>> grok.adapts(table.interfaces.ITable)
>> grok.provides(table.interfaces.IColumn)
>> header = u'Name'
>> attrname = 'who'
>> weight = 1
>
> The column adapts three objects, you just specified one.
>
> grok.adapts(gehar, IDefaultBrowserLayer, ITable)
>
> /Tim
More information about the Grok-dev
mailing list