[Product-Developers] Hiding portlet when there is no data to display.
espen at medialog.no
Mon May 26 09:55:06 UTC 2008
.... sorry, read this on webmail and didnt have the full tread...
seams like this is what you already have done.
Den 26. mai. 2008 kl. 09.16 skrev Espen Moe-Nilssen:
> Probably not the way to do it, but could you solve it by using a
> viewlet and then have an if expression on it ?
> tal:condition="here/data | nothing" />
> Den 30. apr. 2008 kl. 20.43 skrev Arno Blumer:
>> I have made a custom portlet in Plone 3 that displays Cost
>> Estimates/Quotes in certain states under certain
>> The query is such that it wil sometimes return an empty list.
>> Just like Plone's Events portlet, it should not display when the
>> list is empty, i.e. when there are no quotes to display.
>> Also, since it is the only portlet in the right hand column, the
>> whole column should not display when the portlet is empty,
>> just like with the Events portlet.
>> I have tried using
>> def available(self):
>> return len(self._data())
>> but this causes an AttributeError on renderer.available in def
>> def _lazyLoadPortlets(self, manager):
>> retriever = getMultiAdapter((self.context, manager),
>> items = 
>> for p in self.filter(retriever.getPortlets()):
>> renderer = self._dataToPortlet(p['assignment'].data)
>> isAvailable = renderer.available
>> Is this the right way to go about making sure the portlet and
>> column does not display when the portlet's data list is empty?
>> If so, how do I give my Renderer class the "available" property,
>> so that I don't get the AttributeError?
>> At the moment I have placed a condition around my portlet
>> template, to check whether there is data to display.
>> This hides the portlet, but doesn't get rid of the column with the
>> "Manage portlets" link.
>> (Also, I don't want to place conditions in the main_template.)
>> Product-Developers mailing list
>> Product-Developers at lists.plone.org
> Product-Developers mailing list
> Product-Developers at lists.plone.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Product-Developers