locked
Expand/Collapse Grouped Data View RRS feed

  • Question

  • I have a grouped data view that by default is collapsed. I would like to provide the user the ability to click anywhere in the group heading cell to expand/collapse rather than only using he plus/minus icon.

    Can anyone help with this?

    <td class="style1" style="background-position: 0% 0%; height: 22px; background-image: none; background-repeat: repeat; background-attachment: scroll;" colspan="99">
        <xsl:choose>
         <xsl:when test="$groupid='0' or $groupid='9'">
          <xsl:text></xsl:text>
         </xsl:when>
         <xsl:when test="$groupid='1'">
          <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
         </xsl:when>
         <xsl:when test="$groupid='2'">
          <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
          <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
         </xsl:when>
         <xsl:otherwise>
          <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
          <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
          <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes">&amp;nbsp;</xsl:text>
         </xsl:otherwise>
        </xsl:choose>
        <xsl:if test="not($hidedetail)" ddwrt:cf_ignore="1">
         <a href="javascript:" originalAttribute="href" originalPath="javascript:" onclick="javascript:ExpGroupBy(this);return false;">
          <img src="{$imagesrc}" originalAttribute="src" originalPath="{$imagesrc}" border="0" alt="{$alttext}" name="{$altname}" /></a>
        </xsl:if>

        <xsl:text disable-output-escaping="yes" ddwrt:nbsp-preserve="yes" xmlns:ddwrt="&amp;nbsp;http://schemas.microsoft.com/WebParts/v2/DataView/runtime">&amp;nbsp;</xsl:text>
        
        <b>
         
        </b>
        <xsl:if test="$fieldtitle">
         <xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:whitespace-preserve="yes" xml:space="preserve"> </xsl:text>
        </xsl:if>
        <xsl:choose>
         <xsl:when test="$fieldtype='url'">
          <a href="{$fieldvalue}">
           <xsl:value-of select="$fieldvalue" originalAttribute="href" originalPath="{$fieldvalue}">
           <xsl:value-of select="$fieldvalue" />
          </a>
         </xsl:when>
         <xsl:when test="$fieldtype='user'">
          <xsl:value-of select="$fieldvalue" disable-output-escaping="yes" />
         </xsl:when>
         <xsl:otherwise>
          <xsl:value-of select="$fieldvalue" />
         </xsl:otherwise>
        </xsl:choose>
        <xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:whitespace-preserve="yes" xml:space="preserve"> </xsl:text>
        <xsl:text xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" ddwrt:nbsp-preserve="yes" disable-output-escaping="yes">&amp;nbsp;</xsl:text>
        (<xsl:value-of select="count($nodeset)" />)</td>
     
    Saturday, December 27, 2008 5:02 AM

Answers

  • Hi,


    If you want to expand/collapse using heading cell, you can add the JavaScript "javascript:ExpGroupBy(this);return false;" to this cell.
    For example, if you want to use the field to expand/collapse, please try to use the code below:

     
    <b> 
    <href="javascript:" onclick="javascript:ExpGroupBy(this);return false;">  
    <img src="{$imagesrc}" border="0" alt="{$alttext}" name="{$altname}"  style=" visibility: hidden"/>  
    <xsl:value-of select="$fieldtitle" /> 
    </a> 
    </b> 
     



    Xue-Mei Chang
    • Marked as answer by Bill Burke Monday, December 29, 2008 4:23 AM
    Monday, December 29, 2008 3:33 AM
    Moderator

All replies

  • Hi,


    If you want to expand/collapse using heading cell, you can add the JavaScript "javascript:ExpGroupBy(this);return false;" to this cell.
    For example, if you want to use the field to expand/collapse, please try to use the code below:

     
    <b> 
    <href="javascript:" onclick="javascript:ExpGroupBy(this);return false;">  
    <img src="{$imagesrc}" border="0" alt="{$alttext}" name="{$altname}"  style=" visibility: hidden"/>  
    <xsl:value-of select="$fieldtitle" /> 
    </a> 
    </b> 
     



    Xue-Mei Chang
    • Marked as answer by Bill Burke Monday, December 29, 2008 4:23 AM
    Monday, December 29, 2008 3:33 AM
    Moderator
  • Thanks Xue-Mei,

    This works great, alot easier for the user than the small plus/minus sign.....

    Bill
    Monday, December 29, 2008 4:24 AM