https://github.com/alanmacgowan/angular-grid
Basic grid for angular 2
https://github.com/alanmacgowan/angular-grid
angular2 grid
Last synced: 2 months ago
JSON representation
Basic grid for angular 2
- Host: GitHub
- URL: https://github.com/alanmacgowan/angular-grid
- Owner: alanmacgowan
- License: mit
- Created: 2017-09-28T23:38:04.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-06T21:02:47.000Z (over 7 years ago)
- Last Synced: 2025-02-24T03:06:52.550Z (3 months ago)
- Topics: angular2, grid
- Language: TypeScript
- Homepage:
- Size: 4.2 MB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# angular grid [WIP]
[](https://travis-ci.org/alanmacgowan/angular-grid)
[](https://codecov.io/gh/alanmacgowan/angular-grid)
[](http://badge.fury.io/js/angular-app-grid)
[](https://david-dm.org/alanmacgowan/angular-grid?type=dev)
[](https://github.com/alanmacgowan/angular-grid/issues)
[](https://github.com/alanmacgowan/angular-grid/stargazers)
[](https://raw.githubusercontent.com/alanmacgowan/angular-grid/master/LICENSE)## Demo
https://alanmacgowan.github.io/angular-grid/## Table of contents
- [About](#about)
- [Installation](#installation)
- [Documentation](#documentation)
- [Development](#development)
- [License](#license)## About
basic grid for angular 2
## Installation
Install through npm:
```
npm install --save angular-app-grid
```Then include in your apps module:
```typescript
import { NgModule } from '@angular/core';
import { AngularGridModule } from 'angular-app-grid';@NgModule({
imports: [
AngularGridModule.forRoot()
]
})
export class MyModule {}
```Finally use in one of your apps components:
```typescript
import { Component } from '@angular/core';@Component({
template: `
`
})
export class MyComponent {
totalRecords: number = 0;
pageSize: number = 5;
currentPage: number = 1;
currentSort: string = '_id';
currentSortOrder: number = 1;
columns: IGridColumn[] = [];
rows: IGridRow[] = [];constructor() {}
pageChanged(page: number) {
this.currentPage = page;//Call get data
}getBData(page: number, sort: string, order?: number) {
this.rows = [];//get data
}sort(sort: ISortResult) {
this.currentSort = sort.column;
this.currentSortOrder = sort.order;//Call get data
}ngOnInit() {
//Call get data//define grid columns
this.columns = [
{ title: 'Action', name: '_id', type: 'ACTIONS' },
...
];
}itemDelete(entity: IEntity) {
//implement delete functionality
}itemEdit(entity: IEntity) {
//implement edit functionality
}}
```You may also find it useful to view the [demo source](https://github.com/alanmacgowan/angular-grid/blob/master/demo/demo.component.ts).
### Usage without a module bundler
```// everything is exported angularGrid namespace
```
## Documentation
All documentation is auto-generated from the source via [compodoc](https://compodoc.github.io/compodoc/) and can be viewed here:
https://alanmacgowan.github.io/angular-grid/docs/## Development
### Prepare your environment
* Install [Node.js](http://nodejs.org/) and NPM
* Install local dev dependencies: `npm install` while current directory is this repo### Development server
Run `npm start` to start a development server on port 8000 with auto reload + tests.### Testing
Run `npm test` to run tests once or `npm run test:watch` to continually run tests.### Release
* Bump the version in package.json (once the module hits 1.0 this will become automatic)
```bash
npm run release
```## License
MIT