Hi All,
Its been a long time since i had posted. Last week i got a weird issue, that made me do this post.
Content query webpart helps in retreiving the data throughout your Site Collection. In Sharepoint 2013 when I used this CQWP to get data, I had a condition where no data were retrieved. In this condition, the HTML of that particular page got distorted and the webpart zones got shifted.
So everything went on to a mess. It took some time for me to get the fix for this issue.
Please find the solution to fix this issue.
Open the ContentQueryMain.xsl in SharePoint Designer. Find the XSL template OuterTemplate.Empty. As you can see it poorly handles the "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>
Have a good day :)
Its been a long time since i had posted. Last week i got a weird issue, that made me do this post.
Content query webpart helps in retreiving the data throughout your Site Collection. In Sharepoint 2013 when I used this CQWP to get data, I had a condition where no data were retrieved. In this condition, the HTML of that particular page got distorted and the webpart zones got shifted.
So everything went on to a mess. It took some time for me to get the fix for this issue.
Please find the solution to fix this issue.
Open the ContentQueryMain.xsl in SharePoint Designer. Find the XSL template OuterTemplate.Empty. As you can see it poorly handles the "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>
Have a good day :)