Angular MultiView - Customize Item Appearance
To customize views in the MultiView, define an itemTemplate.
HTML
TypeScript
- <dx-multi-view
- [dataSource]="multiViewItems"
- itemTemplate="item">
- <div *dxTemplate="let content of 'item'">
- <div style="margin: 25px;">
- <h1>{{content.title}}</h1>
- <div style="text-align: left;">
- <p *ngFor="let key of getItemKeys(content.data)">
- {{key}}: <b>{{content.data[key]}}</b>
- </p>
- </div>
- </div>
- </div>
- </dx-multi-view>
- import { DxMultiViewModule } from 'devextreme-angular';
- // ...
- export class AppComponent {
- multiViewItems = [{
- title: 'Personal Data',
- data: { firstName: 'John', lastName: 'Smith', birthYear: 1986 }
- }, {
- title: 'Contacts',
- data: { phone: '(555)555-5555', email: 'John.Smith@example.com' }
- }];
- getItemKeys (item) {
- return Object.keys(item);
- }
- }
- @NgModule({
- imports: [
- // ...
- DxMultiViewModule
- ],
- // ...
- })
You can also customize individual views. Declare them using the dxItem component:
HTML
TypeScript
- <dx-multi-view>
- <dxi-item text="Personal Data"></dxi-item>
- <dxi-item text="Contacts"></dxi-item>
- </dx-multi-view>
- import { DxMultiViewModule } from 'devextreme-angular';
- // ...
- export class AppComponent {
- // ...
- }
- @NgModule({
- imports: [
- // ...
- DxMultiViewModule
- ],
- // ...
- })
See Also
Feel free to share topic-related thoughts here.
If you have technical questions, please create a support ticket in the DevExpress Support Center.
Thank you for the feedback!
If you have technical questions, please create a support ticket in the DevExpress Support Center.