# j-Search

> Simple fulltext search component. This component can show/hide elements according to the searching phrase.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: en
Content-SHA256: 5a1c428d462a347a04d0a7b31478bd5690a86558a3b86824856d5b4f3eb05259
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

Simple fulltext search component. This component can show/hide elements according to the searching phrase.


__Configuration__:

- `selector {String}` jQuery selector for searching
- `attribute {String}` element attribute which contains a search phrase (default: `data-search`)
- `class {String}` this class will be used if the element is not found (default: `hidden`)
- `delay {Number}` typing delay (default: `50` ms)
- `delaydatasource {Number}` a delay for re-search when the data-source is changed (default: `100` ms)
- __UPD__ `exec {String}` a link to `function(stats:{ total: Number, count: Number, hidden: Number, search: String, is: Boolean })` which will be evaluated if the component searches for something
- `datasource {String}` a path to data-source for watching of changes
- `splitwords {Boolean}` tries to find word in various position (default: `true`)
- __NEW__ `custom {String}` a path to the `Function(element, search) must return Boolean` for custom searching

__Good to know__:

This component adds the classes below automatically when:

- class `ui-search-used` is added when the user searches for something
- class `ui-search-empty` is added when the user searches for something and at the same time nothing was found

Use it with `<ui-component name="search">`. When the component is not loaded yet, jComponent downloads it on first use from the address in `DEF.fallback` (the Componentator CDN by default). Author: Peter Širka. Source: the Componentator components repository, MIT license.

```html example.html
<ui-component name="textbox" path="search" config="type:search"></ui-component>
<br />
<ui-component name="search" path="search" config="selector:div">
	<div data-search="Apples">Apples</div>
	<div data-search="Oranges">Oranges</div>
	<div data-search="Pears">Pears</div>
	<div data-search="Black-eye bean">Black-eye bean</div>
	<div data-search="Broccoli">Broccoli</div>
</ui-component>

<script>
	var search = '';
</script>
```
