I'm using AG/IG 12.3.
I am attempting to work with the Navigation Drawer Mini example and finding it difficult to introduce content into the separate navigation panes (not wanting to use routing). I have started a basic example.
The first part is the control panel will have a large number of dropdowns and some combo boxes; data will have a data grid; and charts will have a tabbed set of charts (some instances will dynamically generate many vs a static 2 for others or none for some situations). I don't know how to generate any content based on the navigation because it doesn't work like the standard navigation drawer example and there are no other examples that actually show populating something based on navigation.
The second part is that I want the data & chart navigation to show up dynamically, based on whether a button was pushed in Controls or not.
I would prefer if the title of the content is inline with the navigation drawer button to save space, as we are processing a large amount of data.
Hello Chris,
Thank you for posting to Infragistics Community!
I have been looking into your question and prepared a small sample, based on the provided by you, with the Navigation Drawer Mini. The sample demonstrates a possible approach to implementing the listed requirements, however, please feel free to modify it, according to your preferences. I have attached it below.
To render content based on the current navigation item, a pretty straightforward solution would be declaring separate container elements with the help of the ngIf structural directive. These containers could host your custom components, or any content, such as a grid.
Regarding the content title being in line with the drawer button, the igxLayout directive with igxLayoutDir="row" direction could be set on the container element of the icon and title, for example a div. “row” is actually the default direction of the directive. Optionally, additional margin style could be added, to more precisely align the title and the button.
<main igxLayout igxLayoutDir="column"> <div igxLayout igxLayoutDir="row"> <span igxButton="icon" igxToggleAction="navigation" > <igx-icon family="material">menu</igx-icon> </span> <p style="margin: 3px 20px;">{{ selected }}</p> </div> <div *ngIf="selected === 'Controls'"> <app-controls (enableGridNav)="onEnableGridNav($event)" (enableChartNav)="onEnableChartNav($event)" [gridNavEnabled]="gridEnabled" [chartNavEnabled]="chartEnabled"></app-controls> </div> <div *ngIf="selected === 'Data'"> <igx-grid [data]="sampleData" height="450px" width="550px" [autoGenerate]="true"></igx-grid> </div> <div *ngIf="selected === 'Charts'"> <app-charts></app-charts> </div> </main>
About the “Data” and “Chart” navigation items being enabled dynamically, one possible solution, as shown in the sample is to create a custom component, such as ControlsComponent to host the dropdown/buttons, etc. This component can have event emitters to subscribe to in order to enable the nav items, as well as Input properties to set their enabled state between switching the contents. Of course, there exist other possibilities, such as creating a global navigation service, however those can be considered as general Angular concepts, which are not specific to the IgniteUI for Angular library. I hope this helps point you to the right direction towards implementing your requirements.
Best regards,Bozhidara PachilovaAssociate Software Developer
5557.nav-drawer-mini.zip
I'm sure this is a fine example, but for some reason I'm unable to run it on my system. I have done a "yarn install", "npm install", and "npm install --legacy-peer-deps" and raised the memory allocation as high as 36gb and it still throws JavaScript heap errors:
PS C:\Users\csworen\Downloads\5557.nav-drawer-mini\nav-drawer-mini> npm start > example-app@0.0.0 start > node --max_old_space_size=36240 node_modules/@angular/cli/bin/ng serve -o ⠦ Generating browser application bundles (phase: emitting)... <--- Last few GCs ---> [2988:00DA6C38] 34216 ms: Mark-sweep (reduce) 1061.8 (1223.8) -> 1047.7 (1172.8) MB, 1143.6 / 0.0 ms (average mu = 0.393, current mu = 0.000) last resort GC in old space requested [2988:00DA6C38] 35349 ms: Mark-sweep (reduce) 1047.7 (1172.8) -> 1047.6 (1160.8) MB, 1133.8 / 0.0 ms (average mu = 0.239, current mu = 0.000) last resort GC in old space requested <--- JS stacktrace ---> FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
I'm on Node v16.13.0, NPM v8.1.4, and my system has 48gb (23 + 16) of DDR4 memory.
Aside from that, I mentioned in my initial post that I am on 12.3 for both Angular and Infragistics. Would it be possible to get an example with that version? I don't have time to upgrade right now, with so many breaking updates.