Question

I created a custom content query web part where I just want to display one field (Description).

How do I get rid of the fields for Link, Image, SipAddress, LinkToolTip, OpenInNewWindow, and Title? I just want to simplify my custom web part and just have the Description field showing.

enter image description here

Était-ce utile?

La solution

  • Edit the Content Query web part .
  • Get the selected Custom Style Name at Presetnation > Style > Item Style.
  • via SharePoint Designer > Open your Root site.
  • Go to all files > Style library > XSL Style Sheets > ItemStyle.xml
  • Create a copy from ItemStyle.xml to allow rollback then > Edit it as advanced mode.

enter image description here

  • Find the currently selected item style name > check the Variables and styles that corresponded to your fields in your custom style > remove it.

  • Save > Check In > Publish as Major Version.

  • After you finish > go to your QCWP > Edit it > and select your custom style from Presentation > Styles > Item Style > it'should be now removed.

enter image description here

[Suggestion]

Instead of modifying the current item style I suggest to you to create a new item style as the following:

  • Paste the following code at the end of ItemStyle.xml file before </xsl:stylesheet>
  • Change the style class="item link-item" as your old one
   <xsl:template name="DiscOnly" match="Row[@Style='DiscOnly']" mode="itemstyle">


        <div class="item link-item">
            <xsl:call-template name="OuterTemplate.CallPresenceStatusIconTemplate"/>

            <div class="description">
                <xsl:value-of select="@Description" />
            </div>
        </div>
    </xsl:template>

Save > Check In > Publish as Major Version. - After you finish > go to your QCWP > Edit it > and select your custom style from Presentation > Styles > Item Style > the OutPut should be like this.

enter image description here

Licencié sous: CC-BY-SA avec attribution
Non affilié à sharepoint.stackexchange
scroll top