locked
Invisible Content Query WebPart RRS feed

  • Question

  • When there are no results it doesn't display whatsoever. I know i can edit the "empty" template to show a message. However this is not what i require.

    I would still like the div that display the data to show as it has been designed nicely has a header etc, i just want to display "no results" found within the div.

    I think this is down to putting the div that hosts the content query in the contentquerymain file and it only starts when rows are matched.

    Where would i put the outer container, in a different section?

    Any examples would be great!

    Wednesday, January 20, 2016 7:07 PM

All replies

  • Hi

    Please check this below

    http://blogs.technet.com/b/sharepoint_quick_reads/archive/2013/08/01/sharepoint-2013-customize-display-template-for-content-by-search-web-part-cswp-part-1.aspx


    Please remember to click 'Mark as Answer' on the answer if it helps you

    Wednesday, January 20, 2016 8:46 PM
  • That is Search Query not content query, we are using content query as we don't want to wait to for indexes to run for users to see their data.
    Thursday, January 21, 2016 8:40 AM
  • anyone?
    Monday, January 25, 2016 2:12 PM
  • Hi eim,

    I would suggest you can alert the ContentQueryMain.xsl file in the style library\XSL Style Sheets folder.

    For alerting the file, you can firstly search the code line:

    <xsl:template name="OuterTemplate.Empty">

    Then modify this xsl tag with the code snippet like below:

    <xsl:template name="OuterTemplate.Empty">
         <xsl:param name="EditMode" />
              <span>
                   Nope, nothing here to be found.
              </span>
              <xsl:if test="$EditMode = 'True'">
                   <div class="wp-content description">
                        <xsl:value-of disable-output-escaping="yes" select="$cbq_viewemptytext" />
                   </div>
              </xsl:if>
    </xsl:template>

    Here is a detailed article for your reference (also works in SharePoint 2013):

    Show a message when your Content Query Webpart has no results

    Thanks

    Best Regards


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Tuesday, January 26, 2016 5:44 AM
  • Thanks for the reply however that's what i get from editing the empty template, just a message with "no results found".

    I want the container to show as it's nicely formatted with the message "no results found", but i can't find any information on showing this. It seems the content is only display if data exists, i need something to show the content and data results if no content is found.


    Tuesday, January 26, 2016 8:08 AM
  • Hi eim,

    In my environment, when content query web part has no data, then it will show a message such as "No results".

    Please see the screen capture below:

    Did you want to add some extra style or other contents ?

    Thanks

    Best Regards


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.


    Tuesday, January 26, 2016 8:23 AM
  • Yes see below. If i just use the empty template it ignores all my formatting for outputting a nicely formatted webpart and display like yours above. If there is data i get my nicely formatted webpart with content.

    <div class="container">
    <h2>Your tasks</h2>
    <div class="WP-data">

    <!-- this is where the data gets added from itemstyle if no rows i want all the containers to show and a simple message no results found -->

    <p> no results found </p>

    </div>

    </div>

    Tuesday, January 26, 2016 9:07 AM
  • Hi eim,

    If you want to apply custom formmatted style for the text in the XSL template, then it need to add  <style> tag to the xsl and then specify the CSS style in the <style> tag to achieve it.

    Here is a detailed article for your reference:

    Embed CSS/ JavaScript in XSL:

    http://www.jwc3.net/2012/04/embedding-javascript-css-in-xsl-for.html

    Thanks

    Best Regards


    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact tnmff@microsoft.com.

    Wednesday, January 27, 2016 3:36 AM
  • Sorry but this isnt helping.

    I have built various custom xsl styles that have styles built in to them.

    Once again i repeat, the issue is, when no data exists the whole web part does not show, a message of "no data" isn't sufficient. I want the web part to show with it's custom formatting with a message inside saying "no data".

    Wednesday, January 27, 2016 10:08 AM