Javascript Jquery-JS在新搜索前清除表,whitin函数还是out?
目前,我正在通过SPservices从SharePoint 2010检索数据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
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搜索功能