From 805e1bb75864209e8b0f628b90c47641cfedc877 Mon Sep 17 00:00:00 2001 From: sheffieldnick Date: Thu, 2 Apr 2020 10:18:15 +0000 Subject: [PATCH] Added custom search function to List API doc - closes #678 --- docs/api.html | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/docs/api.html b/docs/api.html index bf3fd5bf..cae012cf 100755 --- a/docs/api.html +++ b/docs/api.html @@ -272,7 +272,7 @@

Methods

  • -

    search(searchString, columns)
    +

    search(searchString, columns, searchFunction)
    Searches the list

    itemsInList = [
    @@ -285,7 +285,20 @@ 

    Methods

    listObj.search(); // Show all items in list -listObj.search('Jonny', ['name']); // Only search in the 'name' column
    +listObj.search('Jonny', ['name']); // Only search in the 'name' column + +listObj.search('Jonny', searchFunction); // Custom search for Jonny + +listObj.search('Jonny', ['name'], searchFunction); // Custom search in the 'name' column +

    The optional searchFunction should be of the form:

    + +
    function searchFunction(searchString, columns) {
    +  for (var k = 0, kl = listObj.items.length; k < kl; k++) {
    +     listObj.items[k].found = false;
    +     // Insert your custom search logic here, set found = true
    +
    +  }
    +};