Skip to content

Commit

Permalink
chore(docs): default settings
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomiassaf committed Aug 14, 2019
1 parent 119b276 commit f92b37a
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions apps/ngrid-demo-app/content/features/grid/default-settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: Default Settings
path: features/grid/default-settings
parent: features/grid
ordinal: 3
---
# Default Setting

The grid is configurable, either through `@Input` properties or directly through the grid instance. This is also valid for grid plugins (both built-in and third party).

In most cases, all of the configurations comes with default settings but you can define your own defaults as well.

To define a default configuration we use the `PblNgridConfigService` service:

```typescript
import { NgModule } from '@angular/core';
import { PblNgridConfigService } from '@pebula/ngrid';

@NgModule({ /** Module definition here... */ })
export class MyRootModule {

constructor(gridConfig: PblNgridConfigService) {
gridConfig.set('table', {
showHeader: true,
showFooter: true,
noFiller: true,
});

// automatically enable target events plugin on all grids.
// Eliminates the need to use the `[targetEvents]` directive.
gridConfig.set('targetEvents', {
autoEnable: true
});

}
}

```

The `set` methods accepts 2 parameters, the 1st is the name of the settings group and the 2nd parameter is the settings object for that group.

The grid's core settings are under the `table` group name, other plugins might add additional groups

I> There is no need to define `PblNgridConfigService` in the providers, it is done by the grid's module.

I> For plugins, the plugin author is responsible for adding the support for default settings assignment, they might choose not to do it or allow partial settings to be applied.

0 comments on commit f92b37a

Please sign in to comment.