# j-Empty

> j-Empty: NEW wait {Boolean} waits for the data (default: false)

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

- `path` must contain a data-source which will be watched

__Configuration__:

- `icon {String}` a default icon (default: `ti ti-database`)
- `parent {String}` a parent container which sets a minimal height (default: `parent`)
- `height {Number}` height size (if you don't want to use `parent`, default: `undefined`)
- `margin {Number}` a margin (default: `0`)
- `topoffset {Boolean}` applies `element.offset().top` as a margin (default: `false`)
- `topposition {Boolean}` applies `element.position().top` as a margin (default: `false`)
- __NEW__ `wait {Boolean}` waits for the data (default: `false`)

__Use-case 1__:

```html
<ui-component name="empty" path="datasource" class="hidden">
	Items not found
</ui-component>
<ui-bind path="datasource" config="show:value && value.length" class="hidden"></ui-bind>
```

__Use-case 2__:

```html
<ui-component name="empty" path="datasource" class="hidden">
	<script type="text/html">
		Items not found
	</script>
	<div>
		YOUR CONTENT. This DIV will be hidden automatically if the "datasource" is empty.
	</div>
</ui-component
```

Use it with `<ui-component name="empty">`. 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="empty" path="datasource" config="parent:window;wait:false" class="hidden">The datasource is empty.</ui-component>

<script>

	var datasource = [];

	// Empty component will be hidden after 5 seconds
	PUSH('datasource', { item: 1 }, 5000);

</script>
```
