Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add custom search function to List API docs #678

@sheffieldnikki

Description

@sheffieldnikki

Can this be added to the List API docs please?
As well as the documented:

listObj.search('Jonny'); // Only item with name Jonny is shown (also returns this item)
listObj.search(); // Show all items in list
listObj.search('Jonny', ['name']); // Only search in the 'name' column

search also supports a (currently undocumented) custom search function as the 2nd or 3rd argument:

listObj.search('Jonny', searchFunction); // Custom search for Jonny
listObj.search('Jonny', ['name'], searchFunction); // Custom search in the 'name' column

where searchFunction is a user-supplied function 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

  }
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions