# j-ServerList

> Wersja BETA. ta sieć komponentów jest przeznaczona dla aplikacji pojedynczej i przedsiębiorstwa.Mamy taką samą funkcjonalność jak j-ServerGrid, ale daje programistom więcej wolności, aby stworzyć własną stronę

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

__BETA VERSION__. ta sieć komponentów jest przeznaczona dla aplikacji pojedynczej strony i przedsiębiorstwa.Mamy taką samą funkcjonalność jak `j-ServerGrid`, ale daje programistom większą swobodę tworzenia personalizowanych renderów elementów.

_Data-source_ musi zawierać:

```js
{
	columns: [
		{
			id: 'name',
			name: 'Name',
			width: 150, // optional (default: config.colwidth)
			filtering: false, // optional (default: false)
			sorting: false, // optional (default: false)
			align: 1, // optional: 0 or left (default), 1 or center, 2 or right
			alignheader: 1, // optional: 0 or left (default), 1 or center, 2 or right
			alignfilter: 1, // optional: 0 or left (default), 1 or center, 2 or right
			icon: 'ti ti-home', // optional: column icon
			dirsource: [{ id: 'String|Number|Boolean', name: '...' }] // optional: a dropdown filter (it needs "directory" component)
		}
	],
    items: [{ name: 'Row <b>1</b> will be bold', html: 'RENDER' }, { name: 'Row 2', html: 'RENDER' }, ...] // items
    page: 1,    // current pages
    pages: 30,  // count of pages
    limit: 5,   // items limit per page
    count: 150  // count of items in DB
}
```

__Konfiguracja__:

- `colwidth {Number}` standardową szerokość kolumny w pikselach (default: `150`)
- Pluralizacja `pluralizepages {String}` dla stron (opcjonalna, domyślna: `# pages,# page,# pages,# pages`)
- Pluralizacja `pluralizeitems {String}` dla elementów (opcjonalna, domyślna: `# items,# item,# items,# items`)
- `margin {Number}` - najwyższa marża wysokości (opcjonalna, domyślna: `0`)
- `noborder {Boolean}` może usunąć granicę (default: `false`)
- Wybór `parent {String}` dla opcji wysokości `auto` (default: `window`)
- `height {Number}` - stała wysokość
- `filter {String}` - domyślny pojemnik dla wszystkich filtrów (opcjonalny)
- `click {String}` link do drogi lub `function(row, row_element)`
- `exec {String}` link do `function(type, filter, sort, page)` dla operacji z serwera (podporowane typy: `filter`, `page` i `sort`)
- `display {Boolean}` Auto pozwala na dodanie jComponent Odpowiedzialna klasa `d-xs`, `d-lg`, itp. według szerokości ekranu (default: `true`)
- `empty {String}` jest pustej wiadomości (default: `No records found.`)
- __NEW__: `scrollbarshadow {Boolean}` umożliwia ciemność skręcania (default: `false`)
- __NEW__: `scrolltop {Boolean}` automatycznie skręca się w górę po zmianie źródła danych (default: `true`)

__Dobrze wiedzieć__:

- `NULL('link.to.data')` oceny `config.exec`

## Customizacja

Składnik ServerList próbuje znaleźć szablon Tangular. Jeśli istnieje, składnik używa go. W przeciwnym razie stara się przekazać zawartość z właściwości `html` każdego elementu / rury.

```html
<ui-component name="serverlist" ...>
	<script type="text/html">
		<!-- "value" represents each row -->
		<!-- "$" represents the entire datasource -->
		<div>{{ value.name }}</div>
	</script>
</ui-component>
```

Użyj go z `<ui-component name="serverlist">`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
<style>
	/* CUSTOM FORMATTING */
	.ui-serverlist-items { display: grid; column-gap: var(--gap); grid-template-columns: repeat(4, minmax(0,1fr)); padding: 20px; }
	.ui-serverlist-item { border: 2px solid #E0E0E0; padding: 10px; border-radius: 10px; }
	.ui-serverlist-check { position: absolute; margin: -20px 0 0 -20px; }
</style>

<ui-component name="serverlist" path="data" config="checkbox:1;height:500;exec:filtering">
	<script type="text/html">
		<div>{{ value.name }}, total pages: {{ $.pages }}</div>
	</script>
</ui-component>

<script id="datasource" type="text/json">
{
	"items": [
		{
			"id": "1",
			"name": "Hello world! 1",
			"createdby": "Peter Sirka",
			"dtcreated": "2024-11-25T22:43:53.455Z"
		},
		{
			"id": "2",
			"name": "Hello world! 2",
			"createdby": "Peter Sirka",
			"dtcreated": "2024-11-25T22:43:53.455Z"
		},
		{
			"id": "3",
			"name": "Hello world! 3",
			"createdby": "Peter Sirka",
			"dtcreated": "2024-11-25T22:43:53.455Z"
		}
	],
	"count": 1,
	"page": 2,
	"limit": 50,
	"pages": 3,
	"columns": [
		{
			"id": "name",
			"name": "Message",
			"icon": "ti ti-envelope",
			"filtering": true,
			"sorting": true
		},
		{
			"id": "createdby",
			"name": "Created by",
			"filtering": true,
			"sorting": true
		},
		{
			"id": "dtcreated",
			"name": "Created",
			"icon": "ti ti-calendar",
			"filtering": true,
			"sorting": true
		}
	]
}
</script>


<script>

	var data = PARSE('#datasource');

	function filtering(type, filter, sort, page) {
		console.log('Type:', type, 'Filter:', filter, 'Sort:', sort, 'Page:', page);
		UPD('data');
	}

</script>
```
