以下代码检查div class =“ ids”下的值是否存在,如果存在,它将在搜索时向我显示结果。例如:value = Headphones-将自动完成并显示“ Headphones”。我要尝试做的是添加一个检查,当找不到要搜索的值时,该检查会自动完成显示“无结果”的文本。
$(function() {
var availableTags = $.makeArray($('div.ids').map((i,d)=>$(d).text()));
$("#Search").autocomplete({source: availableTags});
});
我该怎么办?
答案 0 :(得分:0)
DECLARE @maxZipSize INT = 1000;
WITH RunningTotal
AS (
SELECT p.ID,
PrintGroup,
SUM(p.FileSize) OVER (
ORDER BY p.ID
) AS CumlativeFileSize,
fileSizes.FileSize
FROM PendingDocuments p
INNER JOIN (
SELECT ID,
FileSize
FROM PendingDocuments
) AS fileSizes
ON fileSizes.ID = p.ID
),
recursiveCTE
AS (
SELECT RunningTotal.ID,
RunningTotal.CumlativeFileSize,
RunningTotal.FileSize,
RunningTotal.FileSize AS BinSize,
1 AS BatchNumber
FROM RunningTotal
WHERE RunningTotal.ID = 1
UNION ALL
SELECT recursiveCTE.ID + 1,
RunningTotal.CumlativeFileSize,
RunningTotal.FileSize,
(
CASE
WHEN RunningTotal.FileSize + BinSize > @maxZipSize
THEN RunningTotal.FileSize
ELSE BinSize + RunningTotal.FileSize
END
) AS BinSize,
(
CASE
WHEN RunningTotal.FileSize + BinSize > @maxZipSize
THEN recursiveCTE.BatchNumber + 1
ELSE recursiveCTE.BatchNumber
END
) AS BatchNumber
FROM recursiveCTE
INNER JOIN RunningTotal
ON recursiveCTE.ID + 1 = RunningTotal.ID
)
SELECT *
FROM recursiveCTE