-
Notifications
You must be signed in to change notification settings - Fork 75
Getting started
Damian Wajdlich edited this page Apr 19, 2017
·
35 revisions
- Installation
- Dashboard with drag and resize
- Adding widgets by drag from outside
- Dynamic dashboard configuration change
- Responsive behaviour
npm install angular2gridsterOnce installed you need to import our module:
...
import { GridsterModule } from 'angular2gridster';
@NgModule({
declarations: [
AppComponent
],
imports: [
...
GridsterModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }The example code shows AppModule, but it could also be imported in other module - depends where you want to use it.
It's enough to place following code in component your want to render dashboard:
<gridster [options]="gridsterOptions" [draggableOptions]="{ handlerClass: 'panel-heading' }">
<gridster-item *ngFor="let widget of widgets"
[(x)]="widget.x" [(y)]="widget.y" [(w)]="widget.w" [(h)]="widget.h">
<!--some content-->
</gridster-item>
</gridster>Gridster configuration can be defined as follows:
widgets: Array<any> = [...];
gridsterOptions = {
lanes: 5,
direction: 'vertical',
dragAndDrop: true,
resizable: true
};DraggableOptions is optional configuration. In this example it defines that dragging widgets should be only possible by element with given class.
By default drag is possible by all widget element.