Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/402.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
Javascript Jquery-JS在新搜索前清除表,whitin函数还是out?_Javascript_Jquery_Sharepoint 2010 - Fatal编程技术网

Javascript Jquery-JS在新搜索前清除表,whitin函数还是out?

Javascript Jquery-JS在新搜索前清除表,whitin函数还是out?,javascript,jquery,sharepoint-2010,Javascript,Jquery,Sharepoint 2010,目前,我正在通过SPservices从SharePoint 2010检索数据 function getData() { $().SPServices({ operation: "GetListItems", async: true, listName: "RapportenLijst", completefunc: function (xData, Status) { $('#result

目前,我正在通过SPservices从SharePoint 2010检索数据

function getData() {

    $().SPServices({

        operation: "GetListItems",

        async: true,

        listName: "RapportenLijst",

        completefunc: function (xData, Status) {

            $('#result').text(xData.responseText);

            $(xData.responseXML).SPFilterNode("z:row").each(function () {

               ......CODE HERE ESSENTIALY FILTERING z:row; manipulating them to Table rows.

                    $("#Search").blur(function () {

                        $("#btnFNWrapper").hide();
                        $("#rapportLink").hide();
                        $("#navigationSection").hide();
                        $("#welcomeHead").slideUp(750);

                        if ($("#Search").val() !== "") {
                            $("#searchWrap").show();
                        } else {
                            alert("Nothing to be searched.");
                        }


                        if (rapportCatEx.indexOf($("#Search").val() != "") != -1) {
                            $("#tableSearch").append(linkRow);
                        }



                        var zoekOpdracht = this.value;
                        var zoekCat  = rapportCatEx.toLowerCase();
                        var zoekNaam = name.toLowerCase();


                        if (zoekNaam.indexOf($("#Search").val()) != -1) {
                            $("#tableSearch").empty().prepend(linkRow);
                        }

                    });


}
在这里,我做了一个搜索功能,根据名称过滤行并显示它

问题是,在这一点上,我让它显示搜索结果。但是当用户需要另一个搜索时,它不会清空以前的搜索结果

我尝试使用..empty(),但它只是迭代、清理表、添加行、清理表、添加行

Sow当应显示多个点击时,它只显示一个。当只有一个点击应该显示,它显示了一个

我如何使它只清理表一次,然后附加所有找到的命中


是我在函数getData()中执行函数Whit吗

您可以将jQuery datatable与SPservices库一起使用,因为jQuery datatable具有OOB搜索功能