【问题标题】:Sharepoint 2010. Webpart form filter applied to listview doesn't clearSharepoint 2010. 应用于列表视图的 Webpart 表单过滤器不清除
【发布时间】:2014-02-19 04:51:42
【问题描述】:

我在显示多条记录的页面上有一个列表视图。每条记录都有“ID”列(1,2,3,4 ...)。我想让用户使用文本字段过滤列表视图。用户键入他/她搜索的“ID”值,单击“查找”按钮,列表视图应显示符合用户条件的记录。我添加了带有文本字段的表单 webpart,并通过连接属性将其连接到列表,如下所述:

How do you filter a SharePoint list with a text field?

这在第一次很有效:当用户输入值并按下“搜索”时 - 列表视图被过滤为预期。

当用户尝试删除过滤器时会出现问题。 1.用户无法通过“ID”列的下拉菜单删除过滤器。尽管列显示为已过滤(显示特殊图标),但它根本不起作用。 2.用户无法通过删除文本字段中的所有符号并再次单击“搜索”来删除过滤器。

我做错了什么?

我发现了类似的问题: http://www.dotnetspark.com/links/47412-unable-to-clear-filter-on-sharepoint-list.aspx

但没有提出解决方案:(

更新

这是文本字段的临时解决方案 - 当它为空并且用户单击“搜索”时,整个页面都会被刷新。我不确定这是否是最佳做法(我更愿意在不刷新页面的情况下更新列表视图)。

<div onkeydown="T1keydown()">
  <input type="text" name="T1" id="T1T1"/>
  <input type="button" value="Search" onclick="T1apply()"/>

  <script type="text/javascript">

function T1keydown() {
  if (event.keyCode == 13) 
    T1apply();
}

function T1apply() {
  var text = document.getElementById("T1T1").value;
  if (text.length > 0) 
  {
    _SFSUBMIT_;
    return;
  }
  window.location.href=window.location.href;
}

  </script>
</div>

【问题讨论】:

    标签: listview sharepoint sharepoint-2010 web-parts


    【解决方案1】:

    也许你会喜欢这个。只需添加一个内容编辑器/Html 表单 webpart。并添加以下代码。这样您可以更好地控制外观和您想要做什么。

    $(document).ready(function() {
    
    
      $("#search").click(function() {
        var id = $("#IDVal").val();
        var params = "FilterFeild1=ID&FilterValue1=" + id;
        //alert(params);
        location.href = location.href.split("?")[0] + "?" + params;
    
    
      });
    
    });
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
    <input type="text" id="IDVal" />
    <input type="button" id="search" value="Search" />

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-03
      • 1970-01-01
      • 2012-07-26
      • 2013-02-07
      • 2015-08-12
      • 1970-01-01
      • 1970-01-01
      • 2012-11-14
      相关资源
      最近更新 更多