I have columnChooser working on Grids but can’t get it to open on TreeGrid. I’m wondering if it works a bit differently. The TreeGrid works, drags and drops, filters, sorts.
Here’s what I’ve got:
package.json
"@syncfusion/ej2-angular-treegrid": "^19.3.43",
.ts
import { TreeGridComponent, RowDDService, SelectionService, EditService, SortService,
FilterService, Filter, ColumnChooserService } from '@syncfusion/ej2-angular-treegrid';
import { ToolbarItems, ToolbarService, ExcelExportService } from '@syncfusion/ej2-angular-treegrid';
providers: [ToolbarService, ExcelExportService, RowDDService,
SelectionService, EditService, SortService, FilterService, ColumnChooserService],
@ViewChild('TreeGrid')
public TreeGrid: any; //TreeGridComponent here doesn’t help. ‘Any’ supports my Drag and Drop code.
dataBoundTreeGrid() {
Object.assign((this.TreeGrid.grid.filterModule as any).filterOperators, { startsWith: 'contains' });
}
I even threw this in:
toolbarClick(args: ClickEventArgs): void {
console.log(args.item.id);
switch (args.item.id) {
case 'TreeGrid_gridcontrol_columnchooser':
this.TreeGrid.openColumnChooser();
break;
.html
<ejs-treegrid #TreeGrid id='TreeGrid' [dataSource]='requirements'
[allowRowDragAndDrop]='true'
(dataBound)='dataBoundTreeGrid()'
[showColumnChooser]= 'true'
[toolbar]='toolbarOptions'
(toolbarClick)='toolbarClick($event)'
[selectionSettings]='selectionOptions'
[treeColumnIndex]='0' childMapping='subitems'width = '1400' height = '715'
[allowFiltering]='true'
allowTextWrap='true' [textWrapSettings]='wrapSettings'
enableCollapseAll='true' [allowExcelExport]='true'
[allowFiltering]='true'
[allowSorting]='true'
(actionBegin)='onActionBegin($event)'
(actionComplete)="Complete($event)"
(rowDrop)='rowDrop($event)'
>
Thanks for the assist.
[app.component.html]
|
[app.component.ts]
import { Component, OnInit } from '@angular/core';
import { sampleData } from './jsontreegriddata';
import { TreeGridComponent, PageService, ColumnChooserService, ToolbarService} from '@syncfusion/ej2-angular-treegrid';
import {PageSettingsModel } from '@syncfusion/ej2-angular-grids';
@Component({
selector: 'app-root',
templateUrl: 'app.component.html',
providers: [ PageService, ColumnChooserService, ToolbarService ]
})
export class AppComponent implements OnInit {
public data: Object[] = [];
public pageSettings: PageSettingsModel;
public toolbar: string[];
ngOnInit(): void {
this.data = sampleData;
this.pageSettings = { pageSize: 10 };
this.toolbar = ['ColumnChooser'];
}
} |
I have defined it:
this.toolbarOptions = ['ExcelExport', 'ColumnChooser'];
It works in other places. I must have some sort of conflict somewhere.
Thanks.
I'm not even sure what fixed it. I stripped it down and rebuilt it.
Magically it works now. Thanks for the support.