New features
Version 3.x > New features > Webcontainer and hide if no data View modes: 
User avatar
Member
Member
ralph - 5/11/2008 5:17:40 PM
   
Webcontainer and hide if no data
I think that if I use a repeater with a web conatiner and I check the "hide if no record found" box is checked, the container should be omitted as well.

Example you have a event box where you want to show upcoming events in the next two weeks, but there are no events, then you will see an empty container, that makes no sense to a user.

In this case simply nothing should be rendered.

Maybe in upcoming releases there should be an additional checkbox called "hide CONTAINER if no record found".

Thanks
ralph

User avatar
Member
Member
ralph - 5/23/2008 10:34:12 AM
   
RE:Webcontainer and hide if no data
For now I solved this problem via entering a javascript that hides the container via js/css.

It works, but it is a hack....

User avatar
Member
Member
info@kearnytech.com - 5/29/2008 5:49:53 PM
   
RE:Webcontainer and hide if no data
ralph,

Would you mind sharing your hack?

charles

User avatar
Member
Member
ralph - 5/29/2008 6:00:11 PM
   
RE:Webcontainer and hide if no data
Not at all

The webcontainer needs an id, example:

<h2 id="webpart-header">Headline</h2>

Then I have a small javascript function that is attached in an external js file:

/* Hide Webcontainer via javascript if empty*/
function hideLayer(element) {
elem = document.getElementById( element );
elem.style.display = "none";
}

****
Now in the wep part configuration, at no data behaviour, you uncheck the checkbox and call the js function by entering following script in the no record found text:
<script type="text/javascript">hideLayer("webpart-header");</script>

Whereby webpart-header the id name of your container is. You could also have a more complex <div> structure here.

And you are done.

ralph