ForgeKomponenty
cs

Komponenty

j-ServerGrid

jComponent 20 · jcomponent@20 component Příklad načten s jComponent 20

BETA VERSION. Tato síť je navržena pro jediné stránky a podnikové aplikace. Je to jednoduchá alternativa k mnohem silnějšímu j-DataGrid.

Data-source musí obsahovat:

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

Konfigurace:

  • colwidth {Number} je standardní šířka sloupce v pixelů (předvolený: 150)
  • Pluralizace pluralizepages {String} pro stránky (volitelné, výchozí: # pages,# page,# pages,# pages)
  • Pluralizace pluralizeitems {String} pro položky (volitelné, výchozí: # items,# item,# items,# items)
  • margin {Number} je vrcholová hranice pro výšku (volitelná, výchozí: 0)
  • noborder {Boolean} může odstranit hranici (předvolené: false)
  • Výběr parent {String} pro možnost výšky auto (předvolený: window)
  • height {Number} - pevná výška
  • filter {String} je standardní držák místa pro všechny filtry (volitelné)
  • click {String} odkaz na cestu nebo function(row, row_element)
  • cell {String} odkaz na cestu nebo function(row, cell_element, column)
  • exec {String} odkaz na function(type, filter, sort, page) pro serverové operace (podporované typy: filter, page a sort)
  • opacity {Number} je výchozí opacita pozadí pro barvy sloupců (důvodní: 0.3);
  • NEW: scrollbarshadow {Boolean} umožňuje sklonový stín (předvolený: false)
  • NEW: scrolltop {Boolean} se automaticky otáčí na vrcholu po změně zdroje dat (předvolený: true)

Dobré vědět:

  • NULL('link.to.data') Hodnocení config.exec

Použijte ji s <ui-component name="servergrid">Pokud je součástka ještě nezačleněna, jComponent Stáhnout ji na první použití z adresy DEF.fallback a) The Componentator CDN dle předvolby. autor: Peter Širka. zdroj: Componentator Výrobce je autorizován, MIT licence.

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>