ForgeKomponensek
hu

Komponensek

j-ServerList

jComponent 20 · jcomponent@20 component Példa betöltve a jComponent 20-szal

BETA VERSION. Ez az összetevő egyoldalú és vállalati alkalmazásokra készült.Ez ugyanazt a funkcionalitást éri el, mint a j-ServerGrid, de több szabadságot ad a fejlesztőknek a személyre szabott elem rendereléséhez.

Az adatforrásnak tartalmaznia kell:

{
	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
}

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)
  • exec {String} egy link a function(type, filter, sort, page) szerver oldalán (támogatott típusok: filter, page és sort)
  • A display {Boolean} lehetővé teszi az automatikus hozzáadását a jComponent választható osztályú d-xs, d-lg, stb. a képernyő szélességének megfelelően (például: true)
  • empty {String} egy üres üzenet (default: No records found.)
  • 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

Custom Template

A ServerList komponens megpróbálja megtalálni a Tangular sablonot. ha van, az komponens használja azt. Ellenkező esetben megprózik egy tartalmat a html tulajdonságból minden elem / rózsa.

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

Használja a <ui-component name="serverlist">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.

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>