【发布时间】:2019-11-13 10:25:24
【问题描述】:
在我的 Sharepoint 2016 页面上,我有一个列表和一个通过过滤列表的脚本编辑器创建的搜索功能。我在 Sharepoint 2013 页面上使用了完全相同的功能,但是在这个 2016 页面上,脚本似乎没有在正确的时间加载,并且在使用搜索时没有任何反应。如果我进入编辑模式,搜索工作。有人可以帮助我需要添加什么延迟/“在脚本准备好代码之前不要加载页面”? Javascript 或 JQuery 可以,脚本正在加载我遗漏的本地库。谢谢
<script type="text/javascript">
$(document).ready(function() {
var list = $("table.ms-listviewtable");
// Loads the list from table
var listItems = $("table.ms-listviewtable tr:not(.ms-viewheadertr)");
// Filters the table
var input = $("input#filterInput");
input.keyup(function() // When typing the search box, the function runs...
{
//Insert line or function here to convert first letter to uppercase?
listItems.each(function() // For every item in the catalogue
{
var text = $(this).text().toLowerCase(); // Load all the text values
if (text.indexOf(input.val().toLowerCase()) != -1) // Compare the user input to the text value
{
$(this).show();// If it matches, show it
}
else
{
$(this).hide(); // If not, hide it
}
});
});
});
</script>
【问题讨论】:
标签: javascript sharepoint