Skip to content

Commit

Permalink
Merge pull request #1166 from IgniteUI/tzhelev/list-density-docs
Browse files Browse the repository at this point in the history
[DO NOT MERGE] Update list topic with display density
  • Loading branch information
gedinakova authored May 6, 2019
2 parents 3d2d806 + 2d08718 commit 363bea2
Show file tree
Hide file tree
Showing 3 changed files with 123 additions and 0 deletions.
41 changes: 41 additions & 0 deletions en/components/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,47 @@ toggleFavorite(item: IgxListItem) {
}
```

Let's also allow the user to choose the display density of the list by using its [`displayDensity`]({environment:angularApiUrl}/classes/igxlistcomponent.html#displaydensity) input. We will do this by importing the `IgxButtonGroupModule` and using the [**IgxButtonGroup**](buttonGroup.md) to display all density values. This way whenever one gets selected, we will update our own **density** property that is bound to the [`displayDensity`]({environment:angularApiUrl}/classes/igxlistcomponent.html#displaydensity) of the list.

```typescript
// app.module.ts
...
import { IgxButtonGroupModule } from 'igniteui-angular';

@NgModule({
imports: [..., IgxButtonGroupModule]
})
```

```html
<!--contacts.component.html-->

<igx-buttongroup [values]="displayDensities" (onSelect)="selectDensity($event)"></igx-buttongroup>
...
<igx-list [displayDensity]="density">
...
</igx-list>
```

```typescript
// contacts.component.ts

public density = "comfortable";
public displayDensities;

public ngOnInit() {
this.displayDensities = [
{ label: 'comfortable', selected: this.density === 'comfortable', togglable: true },
{ label: 'cosy', selected: this.density === 'cosy', togglable: true },
{ label: 'compact', selected: this.density === 'compact', togglable: true }
];
}

public selectDensity(event) {
this.density = this.displayDensities[event.index].label;
}
```

And here's the result of all that work:

<div class="sample-container loading" style="height: 477px">
Expand Down
41 changes: 41 additions & 0 deletions jp/components/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,47 @@ toggleFavorite(item: IgxListItem) {
}
```

Let's also allow the user to choose the display density of the list by using its [`displayDensity`]({environment:angularApiUrl}/classes/igxlistcomponent.html#displaydensity) input. We will do this by importing the `IgxButtonGroupModule` and using the [**IgxButtonGroup**](buttonGroup.md) to display all density values. This way whenever one gets selected, we will update our own **density** property that is bound to the [`displayDensity`]({environment:angularApiUrl}/classes/igxlistcomponent.html#displaydensity) of the list.

```typescript
// app.module.ts
...
import { IgxButtonGroupModule } from 'igniteui-angular';

@NgModule({
imports: [..., IgxButtonGroupModule]
})
```

```html
<!--contacts.component.html-->

<igx-buttongroup [values]="displayDensities" (onSelect)="selectDensity($event)"></igx-buttongroup>
...
<igx-list [displayDensity]="density">
...
</igx-list>
```

```typescript
// contacts.component.ts

public density = "comfortable";
public displayDensities;

public ngOnInit() {
this.displayDensities = [
{ label: 'comfortable', selected: this.density === 'comfortable', togglable: true },
{ label: 'cosy', selected: this.density === 'cosy', togglable: true },
{ label: 'compact', selected: this.density === 'compact', togglable: true }
];
}

public selectDensity(event) {
this.density = this.displayDensities[event.index].label;
}
```

結果は以下のようになります。

<div class="sample-container loading" style="height: 477px">
Expand Down
41 changes: 41 additions & 0 deletions kr/components/list.md
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,47 @@ toggleFavorite(item: IgxListItem) {
}
```

Let's also allow the user to choose the display density of the list by using its [`displayDensity`]({environment:angularApiUrl}/classes/igxlistcomponent.html#displaydensity) input. We will do this by importing the `IgxButtonGroupModule` and using the [**IgxButtonGroup**](buttonGroup.md) to display all density values. This way whenever one gets selected, we will update our own **density** property that is bound to the [`displayDensity`]({environment:angularApiUrl}/classes/igxlistcomponent.html#displaydensity) of the list.

```typescript
// app.module.ts
...
import { IgxButtonGroupModule } from 'igniteui-angular';

@NgModule({
imports: [..., IgxButtonGroupModule]
})
```

```html
<!--contacts.component.html-->

<igx-buttongroup [values]="displayDensities" (onSelect)="selectDensity($event)"></igx-buttongroup>
...
<igx-list [displayDensity]="density">
...
</igx-list>
```

```typescript
// contacts.component.ts

public density = "comfortable";
public displayDensities;

public ngOnInit() {
this.displayDensities = [
{ label: 'comfortable', selected: this.density === 'comfortable', togglable: true },
{ label: 'cosy', selected: this.density === 'cosy', togglable: true },
{ label: 'compact', selected: this.density === 'compact', togglable: true }
];
}

public selectDensity(event) {
this.density = this.displayDensities[event.index].label;
}
```

And here's the result of all that work:

<div class="sample-container loading" style="height: 477px">
Expand Down

0 comments on commit 363bea2

Please sign in to comment.