I have built in toolbar items and custom toolbar as shown below
While buttons works just fine I am trying to add dropdown into toolbar because "ColumnChooser" is not working for me. Also, I have toolbarClick event.
Don't know what is wrong but "ColumnChooser" is not working so i am forced to add custom dropdown into my toolbar for grid. what am i missing here
I have updated the code here https://stackblitz.com/edit/angular-y9udmo-yqfo2y?file=app.component.ts
[app.component.html]
<ejs-grid
#grid
[dataSource]="data"
allowPaging="true"
[pageSettings]="pageSettings"
[editSettings]="editSettings"
[toolbar]="toolbar"
showColumnChooser="true"
(actionComplete)="actionComplete($event)"
>
<e-columns>
. . . .
</e-columns>
</ejs-grid>
<ng-template #template let-data>
<ejs-dropdownlist
id="games"
#sample
[dataSource]="sportsData"
(change)="onChange($event)"
[value]="value"
[fields]="fields"
[placeholder]="waterMark"
[popupHeight]="height"
></ejs-dropdownlist>
</ng-template> |
[app.component.ts]
@ViewChild('template')
public toolbarTemplate: any;
this.toolbar = ['ColumnChooser', { template: this.toolbarTemplate }]; |
Hi,
can we remove OrderID from the Column Chooser dropdown and columns are auto generating.
regards,
Pawan
Hi Pawan,
From your query, we understand that you want to hide a particular column in the Column Chooser popup while the columns are auto-generated. You can achieve your requirement by setting the “column.showInColumnChooser” property inside the “dataBound” event. Please refer to the below code example, documentation, and sample link for more information.
[html] <ejs-grid #grid [dataSource]="data" allowPaging="true" [pageSettings]="pageSettings" [editSettings]="editSettings" [toolbar]="toolbar" showColumnChooser="true" (dataBound)="dataBound($event)"> </ejs-grid>
[ts] dataBound(args) { this.gridInstancs.getColumnByField('OrderID').showInColumnChooser = false; }
|
Documentation : https://ej2.syncfusion.com/angular/documentation/grid/columns/auto-generated-columns/#set-column-options-to-auto-generated-columns
Sample : https://stackblitz.com/edit/angular-ekft7w-onhtgz?file=app.component.html,app.component.ts
Please get back to us if you need further assistance on this.
Regards,
Pavithra S