Lets say I have a list called events.
Using SP Designer I can add a webpart to a page, select the events list, and a data grid with standard sharepoint controls and column filtering will be added to the page, similar to the "allitems.aspx" view of any开发者_StackOverflow社区 list.
The nice thing about the column filtering is that it uses GET requests, using query strings eg:
?FilterField1=location&FilterValue1=usa&FilterField2=qtr&FilterValue2=q2
This allows me to construct urls and send them to people, showing them pre filtered data. When no query strings are present, all items are displayed.
How can I achieve this with xsl data views? The filtering on these are done via POST requests (i.e. the URL never changes or gets query strings appended). I know I can set up a query string parameter and then filter on this parameter, but if the query string is not present, no items are display because it is always looking for the query string for filtering.
Is there any way to make an xsl data view work in a GET request mode?
yes you can what you can do is add a condition is xslt if your xslt parameters storing the querystring values are empty then show all results else filter it based upon the xsl parameters for query string
<xsl:choose>
<xsl:when test="$qparam1=''">
<xsl:call-template name="allitem" />
</xsl:when>
<xsl:when test="$qparam1!=''">
<xsl:call-template name="filterdeitem">
<xsl:param filter1 = $qparam1/>
</xsl:call-template>
</xsl:when>
</xsl:choose>
精彩评论