On my main landing page of SharePoint, I'm using a few CQWPs and the Blank Web Parts Page layout. One will show your upcoming tasks, one will show the projects you're a member or lead of, etc. I have most of the CQWPs in the Center Left zone. Center and Center Right zones are always populated with something. If a CQWP in the Center Left zone returns no results, the Center and Center Right zone are pushed below the Center Left zone, instead of sitting to the right of Center Left. Anyone know how I can keep the Center and Center Right zones in place even if the CQWP returns no results?
-
@RobertLindgren Actually it's an XSL issue.– user2536May 21, 2013 at 13:47
-
@RobertLindgren It should, yes. But css alone cannot fix it when the very HTML structure becomes broken along the way.– user2536May 21, 2013 at 13:50
-
True that! I have not seen exactly how it breaks the layout so there of my answer. Will clean my earlier comments.– Robert LindgrenMay 21, 2013 at 13:52
1 Answer
I'm guessing this is SP2013, as I myself have only encountered this in SP2013.
My personal explanation to this:
SharePoint 2013 Content By Query web part has a minor bug in its early releases. When returning no items it accidentally breaks the HTML structure of the page.
My solution:
Open the ContentQueryMain.xsl in SharePoint Designer. Find the XSL template OuterTemplate.Empty. As you can see it poorly handles the There exist no items situation.
Replace the template with this:
<xsl:template name="OuterTemplate.Empty">
<xsl:param name="EditMode" />
<xsl:choose>
<xsl:when test="$EditMode = 'True' and string-length($cbq_errortext) = 0">
<div class="wp-content description">
<xsl:value-of disable-output-escaping="yes" select="$cbq_viewemptytext" />
</div>
</xsl:when>
<xsl:otherwise>
<div style="display:none">No content found</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
This way it renders something when there's nothing else to render and it does not break the HTML structure of the rest of the page.
I hope this solves your issue.
-
1
-
@chanalevy You're welcome :)– user2536Jul 9, 2014 at 13:06
-
-
@Richard Not that I'm aware of.– user2536Jan 29, 2015 at 7:50
-