Generic UI Angular Grid API

Grid API

The grid library provides an api to make changes to the grid components. It also allows to retrieve data handled by the grid.

import { GuiGridComponent, GuiGridApi } from '@generic-ui/ngx-grid';

	template: `
	<gui-grid #grid ...></gui-grid>
class ExampleComponent implements AfterViewInit {
	@ViewChild('grid', { static: true })
	gridComponent: GuiGridComponent;
	ngAfterViewInit {
		const api: GuiGridApi = this.gridComponent.api;


setSource(items: Array<any>): voidSets new source for the grid.
deleteRow(row: GuiSelectedRow): voidDeletes row.
deleteRows(rows: Array<GuiSelectedRow>): voidDeletes an array of rows.
getSelectedRows(): Array<GuiSelectedRow>Returns an array of selected rows.
showLoading(): voidTurns on and shows loading overlay.
hideLoading(): voidHides loading overlay.

selectAll(): voidSelects all rows.
unselectAll(): voidUnselects all rows.

scrollToTop(): voidScrolls grid to the top.
scrollToBottom(): voidScrolls grid to the bottom.
scrollToRowByIndex(index: number): void;Scrolls grid to the target row.

setSearchingConfig(config: SearchConfig): voidSets searching config.
search(phrase: string): voidSets search phrase.
clearSearchPhrase(): voidClears search phrase.

enablePaging(): voidTurns on paging.
disablePaging(): voidTurns off paging.
nextPage(): voidMoves to the next page.
prevPage(): voidMoves to the previous page.
changePageSize(pageSize: number): voidChanges page size.
setPagingConfig(config: PagingConfig): voidSets config for paging.

setTheme(theme: string | GuiTheme): voidSets theme.
setVerticalGrid(enabled: boolean): voidSets vertical grid.
setHorizontalGrid(enabled: boolean): voidSets horizontal grid.
setRowColoring(rowColoring: string | GuiRowColoring): voidSets row coloring.

enableVirtualScroll(): voidEnables virtual scroll.
disableVirtualScroll(): voidDisables virtual scroll.

enableSummaries(): voidEnables summaries.
disableSummaries(): voidDisables summaries.

setSortConfig(config: SortingConfig): voidSets configuration for sorting.