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
Name | Description |
---|---|
setSource(items: Array<any>): void | Sets new source for the grid. |
deleteRow(row: GuiSelectedRow): void | Deletes row. |
deleteRows(rows: Array<GuiSelectedRow>): void | Deletes an array of rows. |
getSelectedRows(): Array<GuiSelectedRow> | Returns an array of selected rows. |
showLoading(): void | Turns on and shows loading overlay. |
hideLoading(): void | Hides loading overlay. |
Selection
Name | Description |
---|---|
selectAll(): void | Selects all rows. |
unselectAll(): void | Unselects all rows. |
Viewport
Name | Description |
---|---|
scrollToTop(): void | Scrolls grid to the top. |
scrollToBottom(): void | Scrolls grid to the bottom. |
scrollToRowByIndex(index: number): void; | Scrolls grid to the target row. |
Searching
Name | Description |
---|---|
setSearchingConfig(config: SearchConfig): void | Sets searching config. |
search(phrase: string): void | Sets search phrase. |
clearSearchPhrase(): void | Clears search phrase. |
Paging
Name | Description |
---|---|
enablePaging(): void | Turns on paging. |
disablePaging(): void | Turns off paging. |
nextPage(): void | Moves to the next page. |
prevPage(): void | Moves to the previous page. |
changePageSize(pageSize: number): void | Changes page size. |
setPagingConfig(config: PagingConfig): void | Sets config for paging. |
Visual
Name | Description |
---|---|
setTheme(theme: string | GuiTheme): void | Sets theme. |
setVerticalGrid(enabled: boolean): void | Sets vertical grid. |
setHorizontalGrid(enabled: boolean): void | Sets horizontal grid. |
setRowColoring(rowColoring: string | GuiRowColoring): void | Sets row coloring. |
Virtual scroll
Name | Description |
---|---|
enableVirtualScroll(): void | Enables virtual scroll. |
disableVirtualScroll(): void | Disables virtual scroll. |
Summaries
Name | Description |
---|---|
enableSummaries(): void | Enables summaries. |
disableSummaries(): void | Disables summaries. |
Sorting
Name | Description |
---|---|
setSortConfig(config: SortingConfig): void | Sets configuration for sorting. |