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';

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

		api.selectAll();
	}
}

Modifications

NameDescription
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.

Selection

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

Viewport

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

Searching

NameDescription
search(phrase: string): voidSets search phrase.
clearSearchPhrase(): voidClears search phrase.

Visual

NameDescription
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.

Related articles:

We use cookies to improve your experience. If you continue browsing, we assume that you consent to our use of cookies.