# j-ServerListing

> j-ServerListing: łatwy w użyciu; drugi model $ zawiera informacje o źródle danych { indeks: numer, strona: liczba, strony: liczbę, liczba: liczby, wartość: YOURDATA }

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

__Konfiguracja__:

- Połączenie `paginate {String}` do funkcji `function(page)` dla strony
- `pages {Number}` maks. strony w wersji (default: `3` -> pół + bieżąca strona + pół)
- `scrolltop {Boolean}` automatycznie skręca się, gdy użytkownik zmienia stronę
- `parent {String}` jQuery selektor do uzyskania wysokości, umożliwia stałe obszary z przystosowanymi skrzyniarkami
- `margin {Number}` marża dla `parent` (default: `0`)
- `marginxs {Number}` opcjonalny, górna / dolna margina razem dla szerokości ekranu `xs`
- `marginsm` górna / dolna margina razem dla szerokości ekranu `sm`
- `marginmd` górna / dolna margina razem dla szerokości ekranu `md`
- `marginlg` górna / dolna margina razem dla szerokości ekranu `lg`
- `pluralizeitems` pluralizacja dla liczenia wszystkich elementów, formularz: `# zero,# one,# two-four,# five and more` (jeśli jest pusty, licznik będzie ukryty)
- `pluralizepages` pluralizacja dla liczenia wszystkich elementów, formularz: `# zero,# one,# two-four,# five and more` (jeśli jest pusty, licznik będzie ukryty)
- `modulo {Number}` może dodać puste elementy z obiektem `{ EMPTY: 1 }` (default: `0`)
- `nopages {Boolean}` może ukryć stronę, jeśli strony są mniejsze niż `2` (default: `false`)

__Modelka__:

Model musi być w formacie poniżej:

```javascript
{
	page: Number,
	count: Number,
	pages: Number,
	items: [{...}, {...}]
}
```

__Layout Tangular__:

- `body` {String} zawiera wszystkie renderowane elementy, wyjście jest __HTML__
- `page` {Liczba} aktualna liczba strony
- Liczba stron `pages` {Liczba}
- Liczba elementów `count`

__Tangular elementy__:

- `model` zawiera obiekt z `Array`
- Drugi model `$` zawiera informacje o źródle danych `{ index: Number, page: Number, pages: Number, count: Number, value: YOUR_DATA }`

Użyj go z `<ui-component name="serverlisting">`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
<div class="row">
	<div class="col-sm-6">
		<h2>With layout</h2>
		<ui-component name="serverlisting" path="model" config="paginate:gotopage">
			<script type="text/html">
				<div class="col-xs-4">
					<div>Item: {{ name }}</div>
				</div>
			</script>
			<script type="text/html">
				<div><b>Layout:</b></div>
				<br />
				<div class="row">{{ body | raw }}</div>
			</script>
		</ui-component>
		<br />
	</div>

	<div class="col-sm-6">
		<h2>Without layout</h2>
		<ui-component name="serverlisting" path="model" config="paginate:gotopage">
			<script type="text/html">
				<div>
					<div>Item: {{ name }}</div>
				</div>
			</script>
		</ui-component>
		<br />
	</div>
</div>

<script>

	var model = {};
	model.page = 1;
	model.pages = 3;
	model.count = 10;
	model.items = [];

	for (var i = 0; i < 10; i++)
		model.items.push({ name: GUID(10) });

	function gotopage(page) {
		alert('GO TO PAGE:' + page);
	}

</script>
```
