Skip to content

Commit 805e1bb

Browse files
author
sheffieldnick
committed
Added custom search function to List API doc - closes javve#678
1 parent cf4b090 commit 805e1bb

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

docs/api.html

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ <h3><a name="methods" class="anchor" href="#methods"></a>Methods</h3>
272272

273273
</li>
274274
<li>
275-
<p><strong><a name="search" class="achor" href="#search"></a>search(searchString, columns)</strong><br>
275+
<p><strong><a name="search" class="achor" href="#search"></a>search(searchString, columns, searchFunction)</strong><br>
276276
Searches the list</p>
277277

278278
<pre><code class="javascript">itemsInList = [
@@ -285,7 +285,20 @@ <h3><a name="methods" class="anchor" href="#methods"></a>Methods</h3>
285285

286286
listObj.search(); // Show all items in list
287287

288-
listObj.search('Jonny', ['name']); // Only search in the 'name' column</code></pre>
288+
listObj.search('Jonny', ['name']); // Only search in the 'name' column
289+
290+
listObj.search('Jonny', searchFunction); // Custom search for Jonny
291+
292+
listObj.search('Jonny', ['name'], searchFunction); // Custom search in the 'name' column</code></pre>
293+
<p>The optional <code>searchFunction</code> should be of the form:</p>
294+
295+
<pre><code class="javascript">function searchFunction(searchString, columns) {
296+
for (var k = 0, kl = listObj.items.length; k &lt; kl; k++) {
297+
listObj.items[k].found = false;
298+
// Insert your custom search logic here, set found = true
299+
300+
}
301+
};</code></pre>
289302

290303
</li>
291304
<li>

0 commit comments

Comments
 (0)