Hi,
at the moment I am working on a big project based on Angular 2. Therefore I am using the igniteui-angular2 component extension to be found here https://github.com/IgniteUI/igniteui-angular2
The Problem: I try to manually (by clicking a button) show the popover for the ColumnChooser feature of the UI-Grid. The way I am trying to achieve this is exactly the way it is described in the GettingStarted section of the Github repo I mentioned earlier.But if I click the button I only get the following error in browser-console: "Cannot read property 'hiding' of undefined".
Fact is, that if I do a console.log() of my whole grid I can see that all my options have been added to it correctly, including the features. But only the "featuresList" property is set to undefined. Where is the mistake I am doing?
-------------------------------------------------------------
template.html:
<button (click)="openGridConfig"></button><ig-grid #grid1 [options]="gridOptions"></ig-grid>
component.ts
private gridOptions: IgGrid;@ViewChild("grid1") myGrid: IgGridComponent;...constructor(...) { this.createGridSettings();}...openGridConfig() { this.myGrid.featuresList.hiding.showColumnChooser;}
createGridSettings() { this.gridOptions = { autoCommit: true, dataSource: this.searchResult, autofitLastColumn: false, autoGenerateColumns: true, columns: [ ... ], features: [ { name: "Sorting" }, { name: "Resizing" }, { name: "Hiding" } ], };}
Regards,Markus
Hello,
At the moment using the features list requires defining the features into the template, they shouldn't be inside the gridOptions.
I agree that this would be useful and actually we already have an issue about it - https://github.com/IgniteUI/igniteui-angular2/issues/192
You can subscribe to be notified once this got resolved.
Hi, thank you for the quick response!That already helped a lot because I now can stop searching for the "mysterious" mistake in my own code.I will try to solve it as you suggested, but of course, it would be a lot more convenient using the features list directly in TypeScript.Have a nice day,
Markus
Hello Markus,
You can take a look at the following sample - https://github.com/IgniteUI/igniteui-angular2/blob/master/samples/igGrid-callingMethods/igGrid-APIMethodsTemplate.html
It might be helpful.
If need further assistance please let us know.
Hi Deyan,
I tried declaring my features through the custom tags <features> and in my case <hiding>.Doing that, by rendering the app I get the error that those tags are unknown and can't be compiled. I then tried importing "Features" and "IgHidingFeatures" in my NgModule as well as directly in my NgComponent but that didn't solve the problem. So far I can actually work with tags like <ig-grid>, <ig-combo> and so on...
RegardsMarkus
Hi Markus,
I'm glad to hear that!
I found out I was importing all my resources from a wrong Module. Works everything as it should now, THANK YOU!Have a nice day,Markus
I believe they are exported by the NgModule. Using them should be the same as ig-combo and ig-grid, can you attach a small sample demonstrating this behavior?