ForgeKomponenty
pl

Komponenty

j-ServerGrid

jComponent 20 · jcomponent@20 component Przykład załadowany z jComponent 20

BETA VERSION. ta sieć jest zaprojektowana dla aplikacji pojedynczej strony i przedsiębiorstwa. to prosta alternatywa dla znacznie bardziej potężnego j-DataGrid.

Data-source musi zawierać:

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

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)
  • cell {String} link do drogi lub function(row, cell_element, column)
  • exec {String} link do function(type, filter, sort, page) dla operacji z serwera (podporowane typy: filter, page i sort)
  • opacity {Number} jest opacjami podstawowymi dla kolumn (podstawowe: 0.3);
  • 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

Użyj go z <ui-component name="servergrid">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.

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>