0

I have a list of links which has a lookup column for category which is another list, so my lists are:

Action Category - Title Actions - Title, Category, Link

I want to display the links in a 3 column grid and am using bootstrap/foundation, so after every 3rd column I need to close the row div and open another one.

Can I achieve this using something like the CQWP or am I better off developing a user control?

0

You could use a DVWP. This is code I've used numerous times to show multiple column layouts with DVWPs.

        <xsl:template name="dvt_1.body">
            <xsl:param name="Rows"/>
<!-- start the first row of the table outside of the row loop -->
                <tr>
                    <xsl:for-each select="$Rows">
                        <xsl:call-template name="dvt_1.rowview" />
                    </xsl:for-each>
<!-- end the last row of the table -->
                </tr>
        </xsl:template>


<xsl:template name="dvt_1.rowview">
            <td class="ms-vb" style="width:120px; padding-left: 20px;">
                <xsl:value-of select="@Title" />
            </td>
<!-- after each 4th item, insert a closing tr tag and an opening tr tag for the next row -->
            <xsl:if test="position() mod 4 = 0">
                <xsl:text disable-output-escaping="yes">&lt;/tr&gt;</xsl:text>
                <xsl:text disable-output-escaping="yes">&lt;tr&gt;</xsl:text>
            </xsl:if>
        </xsl:template>

CQWP uses XSLT as well, but the code is in several different files. If you want to customize a CQWP you should create copies instead of editing the originals. Data rows are defined in the ItemStyle.xls and the templates for the outer loops are in ContentQueryMain.xsl. The XSLT for CQWP is not as straightforward as the DVWP and it will take a while to figure out where you need to add your customisations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.