Sharepoint XSL 数据视图查询字符串过滤

发布于 2024-10-25 05:58:40 字数 506 浏览 2 评论 0原文

假设我有一个名为事件的列表。

使用 SP Designer,我可以将 Web 部件添加到页面,选择事件列表,并且具有标准共享点控件和列筛选的数据网格将添加到页面,类似于任何列表的“allitems.aspx”视图。

列过滤的好处是它使用 GET 请求,使用查询字符串,例如:

?FilterField1=location&FilterValue1=usa&FilterField2=qtr&FilterValue2=q2

这允许我构造 url 并发送他们向人们展示预先过滤的数据。当不存在查询字符串时,将显示所有项目。

如何使用 xsl 数据视图实现此目的?对这些内容的过滤是通过 POST 请求完成的(即 URL 永远不会更改或附加查询字符串)。我知道我可以设置一个查询字符串参数,然后根据该参数进行过滤,但是如果查询字符串不存在,则不会显示任何项目,因为它始终在寻找查询字符串进行过滤。

有没有办法让 xsl 数据视图在 GET 请求模式下工作?

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 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦忆晨望 2024-11-01 05:58:40

是的,您可以做的就是添加一个条件是 xslt,如果存储查询字符串值的 xslt 参数为空,则显示所有结果,否则根据查询字符串的 xsl 参数对其进行过滤

<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>

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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文