Github example

This example showcase usage of Generic UI grid with Github API. Typing anything in the input field and the grid will display repositories with the used search phrase. The grid source is directly connected with the Github search API. The grid columns are configured in a way so they can display attributes of the searched repository: name of a repository, its description, used coding language, repository owner, number of stars and forks. The source code of this example can be found at the bottom of this page.

Showing 0 out of 0 results.

Source code

This the source code of the Github example. The search API is used in search() function. The items variable is reflects as a grid's source. The field attribute found in the columns configuration, reflects the values of Github repositories.

<div class="gw-example-github">
	<form [formGroup]="searchForm">

			<input gui-input type="text" placeholder="Type here..." formControlName="query" value="Tetris">
		<button gui-button type="submit" (click)="submit()">Search</button>


	<div class="result-count">
		Showing {{items.length}} out of {{total_count}} results.

import { ChangeDetectionStrategy, ChangeDetectorRef, Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
import { GuiColumn, GuiDataType } from '@generic-ui/ngx-grid';

	templateUrl: './example-github-grid.component.html',
	changeDetection: ChangeDetectionStrategy.OnPush
export class ExampleGithubGridComponent implements OnInit {


	items = [];

	columns: Array<GuiColumn> = [{
		header: 'Full name',
		field: 'full_name',
		type: GuiDataType.STRING
	}, {
		header: 'Description',
		field: 'description',
		type: GuiDataType.STRING
	}, {
		header: 'Language',
		field: 'language',
		type: GuiDataType.STRING
	}, {
		header: 'Owner',
		field: (item: any) => item.owner.login,
		type: GuiDataType.STRING
	}, {
		header: 'Stars',
		field: 'stargazers_count',
		type: GuiDataType.NUMBER,
		width: 100
	}, {
		header: 'Forks',
		field: 'forks',
		type: GuiDataType.NUMBER,
		width: 100

	searchForm: FormGroup;

	fetching = false;

	constructor(private http: HttpClient,
				private formBuilder: FormBuilder,
				private changeDetectorRef: ChangeDetectorRef) {

	ngOnInit() {

		this.searchForm ={
			'query': ['Tetris', [Validators.required]]

	submit(): void {;

	search(): void {

		if (this.fetching) {

		this.fetching = true;

			.get('' + this.searchForm.value.query)
			.subscribe((response: any) => {

				this.total_count = response.total_count;
				this.items = response.items;

				this.fetching = false;


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