# j-DataSource

> Komponent pobiera dane z zewnętrznego źródła za pomocą metody AJAX(), a wartość wiąże się zgodnie z konfiguracją.

Framework: jcomponent20
Product: jComponent 20 (jcomponent@20)
Language: pl
Content-SHA256: 51c2e65cba3be65c828e6a963603dff66a8b08e3726d6ea90621e552116a7191
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: components@910ed1a86f6e72b4f031d3ad0dc7844f9fc5cb8e
Review: not-recorded

Składnik ładuje dane ze źródła zewnętrznego za pomocą metody `AJAX()` i wiąże wartość według wartości `config.path`.


__Konfiguracja__:

- `path {String}` _wymagany_ jest trasa, w której wartość zostanie ustawiona
- `url {String}` opcjonalny, adres URL do uzyskania danych
- `delay {Number}` opcjonalny, opóźnienie (w milisekundach) w uzyskaniu danych (default: `0`)

__Dobrze wiedzieć__:

- `config.path = '#codelist'` określa wartość w listach kodów `DEF.cl.codelist`
- `config.path = '%codelist'` określa wartość w tymczasowym
- `config.path = '?.path` określa wartość według trasy wtyczki
- `config.path = 'absolute.path` określa wartość według ścieżki

__Czy mogę użyć adresów URL?__

Tak, możesz użyć `<ui-component name="datasource" path="..."` do dynamicznego pobierania danych.

```html
<ui-component name="datasource" path="?.urlcities" config="path:#cities"></ui-component>
```

__Jak mogę zmienić dane przed wiążą?__

```html
<ui-component name="datasource" config="url:https://www.yourdomain.com/api/countries/;path:#countries">
	<script type="text/plain">
		var output = [];
		for (var item of value)
			output.push({ id: item.Id, name: item.Name });
		return output;
	</script>
</ui-component>
```

Użyj go z `<ui-component name="datasource">`Gdy element nie jest jeszcze ładowany, jComponent Pobierz go po pierwszym użyciu z adresu `DEF.fallback` (Wydaje się Componentator Autor: Peter Širka Źródło: Componentator Zestaw składników, licencja MIT.

```html example.html
<ui-component name="datasource" config="url:https://www.totaljs.com/dashboard.json;path:#mycodelist">
	<script type="text/plain">
		return value.children;
	</script>
</ui-component>

<ui-bind path="#mycodelist" config="html pre:JSON.stringify(value, null, '  ')" class="block">
	<pre></pre>
</ui-bind>
```
