0.1.6 • Published 6 years ago
ng2-jsgrid v0.1.6
ng2-jsgrid
Installation
To install this library, run:
$ npm install ng2-jsgrid --save
Documents
https://jinhduong.github.io/ng2-jsgrid/index.html
Usage
Firstly, add GridModule
into your Angular AppModule
:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
// Import
import { GridModule } from 'ng2-jsgrid';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
GridModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
Once your library is imported, you can use it in your component
import { Component, OnInit } from '@angular/core';
import { Field } from 'ng2-jsgrid';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
fields: Field[];
api = async (filter) => {
// Call from API with current filter
// Some samples:
// const result = await this._someService.getDate(filter).toPromise();
console.log(filter);
const promise = new Promise((res) => {
setTimeout(() => {
res({
itemsCount: 12,
data: [
{ name: 'John', age: 30 },
{ name: 'Smith', age: 46 },
]
});
}, 3000);
});
const result = await promise;
return result;
}
ngOnInit(): void {
this.fields = [
{ name: 'name', title: 'Name' },
{ name: 'age', title: 'Age' }
];
}
}
Development
To generate all *.js
, *.d.ts
and *.metadata.json
files:
$ npm run build
To lint all *.ts
files:
$ npm run lint
License
MIT © jinhduong
0.1.6
6 years ago
0.1.5
6 years ago
0.1.4
6 years ago
0.1.3
6 years ago
0.1.2
6 years ago
0.1.1
6 years ago
0.1.0
6 years ago
0.0.62
7 years ago
0.0.61
7 years ago
0.0.6
7 years ago
0.0.53
7 years ago
0.0.52
7 years ago
0.0.51
7 years ago
0.0.5
7 years ago
0.0.41
7 years ago
0.0.4
7 years ago
0.0.31
7 years ago
0.0.3
7 years ago
0.0.2
7 years ago
0.0.1
7 years ago