# j-ServerGrid

> BETA VERSION. Ez a hálózat egyoldalú és vállalati alkalmazásokra készült. egyszerű alternatíva a sokkal erősebb j-DataGrid-nek.

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

__BETA VERSION__. Ez a hálózat egyoldalú és vállalati alkalmazásokra készült. egyszerű alternatíva a sokkal erősebb `j-DataGrid`-nek.

Az adatforrásnak tartalmaznia kell:

```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
			color: '#000000' // optional: color for all rows,
			dirsource: [{ id: 'String|Number|Boolean', name: '...' }] // optional: a dropdown filter (it needs "directory" component)
		}
	],
    items: [{ name: 'Row <b>1</b> will be bold', $class: 'NEW: css class for the row', $style: 'NEW: css for the row' }, { name: 'Row 2' }, ...] // items
    page: 1,    // current pages
    pages: 30,  // count of pages
    limit: 5,   // items limit per page
    count: 150  // count of items in DB
}
```

__konfiguráció__:

- `colwidth {Number}` egy alapértelmezett oszlop szélessége pixelekben (alapértelmezés: `150`)
- `pluralizepages {String}` pluralizáció oldalak (opcionális, alapértelmezett: `# pages,# page,# pages,# pages`)
- `pluralizeitems {String}` pluralizáció az elemekre (opcionális, alapértelmezett: `# items,# item,# items,# items`)
- `margin {Number}` a magasság felső marginja (opcionális, alapértelmezett: `0`)
- A `noborder {Boolean}` eltávolíthatja a határt (default: `false`)
- `parent {String}` kiválasztó a `auto` magasság opció (default: `window`)
- `height {Number}` fix magasság
- `filter {String}` - Az összes szűrőre vonatkozó alapértelmezett helytartó (opcionális)
- `click {String}` egy útvonalhoz vagy `function(row, row_element)`
- `cell {String}` egy útvonalhoz vagy `function(row, cell_element, column)`
- `exec {String}` egy link a `function(type, filter, sort, page)` szerver oldalán (támogatott típusok: `filter`, `page` és `sort`)
- `opacity {Number}` alapértelmezett háttérfogyatékosság a oszlop színekhez (alapértelmezés: `0.3`);
- __NEW__: `scrollbarshadow {Boolean}` lehetővé teszi a scrollbar árnyékot (default: `false`)
- __NEW__: `scrolltop {Boolean}` az adatforrás megváltoztatása után automatikusan forog a tetejére (default: `true`)

__Jó tudni__:

- `NULL('link.to.data')` Értékelés `config.exec`

Használja a `<ui-component name="servergrid">`Amennyiben a készülék még nem tölthető le, jComponent letöltés az első felhasználásra a címről `DEF.fallback` (Azt a Componentator A szerző: Peter Širka. forrás: a Componentator Az összetevők raktár, MIT licenc.

```html example.html
<ui-component name="servergrid" path="data" config="checkbox:1;height:500;exec:filtering"></ui-component>

<script id="datasource" type="text/json">
{
	"items": [
		{
			"id": "IuX45p1cl61f",
			"name": "Hello world!",
			"createdby": "Peter Sirka",
			"dtcreated": "2024-11-25T22:43:53.455Z"
		}
	],
	"count": 1,
	"page": 2,
	"limit": 50,
	"pages": 3,
	"columns": [
		{
			"id": "name",
			"name": "Message",
			"width": 300,
			"color": "#F4E8E8",
			"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>
```
