Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/69.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/solr/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sharepoint 2010中的jQuery和JavaScript错误_Javascript_Jquery_Sharepoint 2010_Ribbon - Fatal编程技术网

Sharepoint 2010中的jQuery和JavaScript错误

Sharepoint 2010中的jQuery和JavaScript错误,javascript,jquery,sharepoint-2010,ribbon,Javascript,Jquery,Sharepoint 2010,Ribbon,我下载了一个非常好的sharepoint实时过滤器脚本列表: 我在下面添加代码。我有两个问题。 1.它正在呼叫谷歌服务,我想知道我是否可以避免这种情况,因为我不确定我的公司是否会高兴地知道,每当有人过滤这个列表时,它就会被谷歌删除。 2.代码第106行出现错误“Object不支持此属性或方法”,导致站点的功能区(包括“site action”下拉按钮)消失。我知道它与“show”命令有关,但我不知道如何修复它 如上所述,我正在使用sharepoint 2010。为了安装这段代码,我在我的文档文

我下载了一个非常好的sharepoint实时过滤器脚本列表:

我在下面添加代码。我有两个问题。 1.它正在呼叫谷歌服务,我想知道我是否可以避免这种情况,因为我不确定我的公司是否会高兴地知道,每当有人过滤这个列表时,它就会被谷歌删除。 2.代码第106行出现错误“Object不支持此属性或方法”,导致站点的功能区(包括“site action”下拉按钮)消失。我知道它与“show”命令有关,但我不知道如何修复它

如上所述,我正在使用sharepoint 2010。为了安装这段代码,我在我的文档文件夹中创建了一个文本文档,然后在我的列表下面创建了一个链接到该文档的CEW。这个方法在另一个页面中对我有效,没有任何问题

以下是从上述网站下载的完整代码:

<script src="http://www.google.com/jsapi"></script>
<script>
 google.load("jquery", "1.2.6");
 google.setOnLoadCallback(function() { 
 $(document).ready(function()
 {  
   jQuery.extend(jQuery.expr[':'], {
   containsIgnoreCase: function(a,i,m) {return (a.textContent||a.innerText||jQuery(a).text()||'').toLowerCase().indexOf((m[3]||'').toLowerCase())>=0}
});


$("table.ms-listviewtable tr.ms-viewheadertr").each(function()
{
    if($("td.ms-vh-group", this).size() > 0)
    {
        return; 
    }

    var tdset = "";

    var colIndex = 0;

    $(this).children("th,td").each(function()
    {
        if($(this).hasClass("ms-vh-icon"))
        {
            // attachment
            tdset += "<td></td>";
        }
        else
        {
            // filterable
            tdset += "<td><input type='text' class='vossers-filterfield' filtercolindex='" + colIndex + "' /></td>";                
        }

        colIndex++;
    });

    var tr = "<tr class='vossers-filterrow'>" + tdset + "</tr>";

    $(tr).insertAfter(this);
}); 


$("input.vossers-filterfield")
    .css("border", "1px solid #7f9db9")
    .css("width", "100%")
    .css("margin", "2px")
    .css("padding", "2px")
    .keyup(function()
    {           
        var inputClosure = this;

        if(window.VossersFilterTimeoutHandle)
        {
            clearTimeout(window.VossersFilterTimeoutHandle);
        }

        window.VossersFilterTimeoutHandle = setTimeout(function()
        {
            var filterValues = new Array();

            $("input.vossers-filterfield", $(inputClosure).parents("tr:first")).each(function()
            {               
                if($(this).val() != "")             
                {
                    filterValues[$(this).attr("filtercolindex")] = $(this).val();
                }
            });     


            $(inputClosure).parents("tr.vossers-filterrow").nextAll("tr").each(function()
            {
                var mismatch = false;

                $(this).children("td").each(function(colIndex)
                {
                    if(mismatch) return;

                    if(filterValues[colIndex])
                    {
                        var val = filterValues[colIndex];

                        // replace double quote character with 2 instances of itself
                        val = val.replace(/"/g, String.fromCharCode(34) + String.fromCharCode(34));                         

                        if($(this).is(":not(:containsIgnoreCase('" + val + "'))"))
                        {
                            mismatch = true;
                        }                       
                    }
                });

                if(mismatch)
                {
                    $(this).hide();
                }
                else
                {
                    $(this).show();
                }       
            });             

        }, 250);
    });
   });
 });
</script>

load(“jquery”,“1.2.6”);
google.setOnLoadCallback(函数(){
$(文档).ready(函数()
{  
extend(jQuery.expr[':']{
containsIgnoreCase:function(a,i,m){return(a.textContent | | | a.innerText | | | | jQuery(a).text()| |').toLowerCase().indexOf((m[3]| |').toLowerCase())>=0}
});
$(“table.ms-listviewtable tr.ms-viewheadertr”)。每个(函数()
{
如果($(“td.ms vh组”,this).size()>0)
{
返回;
}
var tdset=“”;
var-colIndex=0;
$(this).children(“th,td”).each(function()
{
if($(此).hasClass(“ms vh图标”))
{
//附件:
tdset+=“”;
}
其他的
{
//可过滤
tdset+=“”;
}
colIndex++;
});
var tr=“”+tdset+”;
$(tr).插入后面(this);
}); 
$(“input.vossers filterfield”)
.css(“边框”,“1px实体#7f9db9”)
.css(“宽度”、“100%”)
.css(“保证金”、“2px”)
.css(“填充”、“2px”)
.keyup(函数()
{           
var-inputClosure=this;
if(window.VossersFilterTimeoutHandle)
{
clearTimeout(window.VossersFilterTimeoutHandle);
}
window.VossersFilterTimeoutHandle=setTimeout(函数()
{
var filterValues=新数组();
$(“input.vossers filterfield”,$(inputClosure).parents(“tr:first”).each(function()
{               
if($(this.val()!=“”)
{
FilterValue[$(this.attr(“filtercolindex”)]=$(this.val();
}
});     
$(inputClosure).parents(“tr.vossers-filterrow”).nextAll(“tr”).each(function()
{
var不匹配=假;
$(this).children(“td”).each(函数(colIndex)
{
如果(不匹配)返回;
if(filterValues[colIndex])
{
var val=过滤值[colIndex];
//将双引号字符替换为其自身的两个实例
val=val.replace(/“/g,String.fromCharCode(34)+String.fromCharCode(34));
if($(this).is(:not(:containsIgnoreCase(“+val+”))))
{
不匹配=真;
}                       
}
});
如果(不匹配)
{
$(this.hide();
}
其他的
{
$(this.show();
}       
});             
}, 250);
});
});
});

据我所见,您只能使用Google代码下载jQuery,并在加载脚本时设置回调。为了避免从Google下载,您不能只加载本地副本jQuery吗

下载jQuery的最小化版本,并将其上载到SharePoint网站(网站资产库或其他地方)

然后在上面的代码中替换这一行

<script src="http://www.google.com/jsapi"></script>


好的。最后-这种使用方式的改变-同时解决另一个问题!!@user3016795您必须提供更多信息。第106行对我来说不存在,我无法在JSFIDLE中运行此代码。打开开发人员工具并添加开始逐步执行代码
<script src="/SiteAssets/{your jquery file name}"></script>
google.setOnLoadCallback(function() { 
    $(document).ready(function() {  
        jQuery.extend(jQuery.expr[':'], {
            containsIgnoreCase: function(a,i,m) {return (a.textContent||a.innerText||jQuery(a).text()||'').toLowerCase().indexOf((m[3]||'').toLowerCase())>=0
        }
    });
});
$(function(){
    jQuery.extend(jQuery.expr[':'], {
        containsIgnoreCase: function(a,i,m) {return (a.textContent||a.innerText||jQuery(a).text()||'').toLowerCase().indexOf((m[3]||'').toLowerCase())>=0
    }
});