Having trouble getting help?
Contact Support
Contact Support
Drill through grid cell edit type in Angular Pivotview component
27 Apr 20245 minutes to read
Using the drillThrough
event in the pivot table, you can define the edit type of a particular column in the grid present inside the drill-through dialog. To do so, check the column name in the drillThrough
event and then specify the edit type of that column using the gridColumns.editType
event argument.
The [
gridColumns.editType
] property must be set based on the column’s data type. For example, the string data type will not be applicable for the numeric text box edit type.
-
NumericTextBox
control for integer, double, and decimal data types. -
TextBox
control for string data type. -
DropDownList
control to show all unique values related to that field. -
CheckBox
control for boolean data type. -
DatePicker
control for date data type. -
DateTimePicker
control for date time data type.
In the below example, the data type of the Country
column is set to DropDownList
.
import { NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { PivotViewAllModule, PivotFieldListAllModule } from '@syncfusion/ej2-angular-pivotview'
import { Component } from '@angular/core';
import { IDataOptions, IDataSet, PivotView, DrillThroughService, DrillThroughEventArgs } from '@syncfusion/ej2-angular-pivotview';
import { CellEditSettings } from '@syncfusion/ej2-pivotview/src/pivotview';
import { Pivot_Data } from './datasource';
@Component({
imports: [
PivotViewAllModule,
PivotFieldListAllModule
],
standalone: true,
selector: 'app-container',
providers: [DrillThroughService],
template: `<ejs-pivotview #pivotview id='PivotView' height='350' [dataSourceSettings]=dataSourceSettings [editSettings]='editSettings' width=width (drillThrough)='drillThrough($event)'></ejs-pivotview>`
})
export class AppComponent {
public width?: string;
public dataSourceSettings?: IDataOptions;
public editSettings?: CellEditSettings;
drillThrough(args:DrillThroughEventArgs | any) {
for (var i = 0; i < args.gridColumns.length; i++) {
if (args.gridColumns[i].field === 'Country') {
args.gridColumns[i].editType = 'dropdownedit';
//args.gridColumns[i].editType = 'numericedit';
//args.gridColumns[i].editType = 'textedit';
//args.gridColumns[i].editType = 'booleanedit';
//args.gridColumns[i].editType = 'datepickeredit';
//args.gridColumns[i].editType = 'datetimepickeredit';
}
}
}
ngOnInit(): void {
this.width = "100%";
this.dataSourceSettings = {
dataSource: Pivot_Data as IDataSet[],
expandAll: false,
enableSorting: true,
drilledMembers: [{ name: 'Country', items: ['France'] }],
columns: [{ name: 'Year', caption: 'Production Year' }, { name: 'Quarter' }],
values: [{ name: 'Sold', caption: 'Units Sold' }, { name: 'Amount', caption: 'Sold Amount' }],
rows: [{ name: 'Country' }, { name: 'Products' }],
formatSettings: [{ name: 'Amount', format: 'C0' }],
filters: []
};
this.editSettings = {
allowEditing: true, allowAdding: true, allowDeleting: true, mode: 'Normal', allowCommandColumns: false,
allowEditOnDblClick: true, showConfirmDialog: true, showDeleteConfirmDialog: false
} as CellEditSettings;
}
}
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));