Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1415
Need to access the child grid property Hierarchal grid load on demand
posted

Hi Team,

I need to access the child grid property to set some conditions. I can access the parent Grid using grid1.propertyname but with child grid i am not able to access.

Please help. Is there a way i can access the child grid property in load on demand feature.

For Parent Grid in TS:

 @ViewChild('grid1', { read: IgxHierarchicalGridComponent, static: false }) public grid1: IgxHierarchicalGridComponent;

 For child Grid in TS:

@ViewChild("childGrid", { static: true }) public rowIsland: IgxRowIslandComponent;
but on console of this.rowIsland is giving me undefined. Pls let  me know how can i access the child grid property and index in TS file. 

Also i need to update the child grid data but as i cannot access this.childGrid.data i am not unable to access.
  • 1320
    Offline posted

    Hello,

    After investigating this further, I have determined that the childGrid returns undefined, because initially only the root grid is rendered, only after the user expands a row, the child grid will be rendered as well.

    What I could suggest is accessing the child grid in a method bound to the gridCreated event as follows:

     <igx-hierarchical-grid #hGrid [primaryKey]="'CustomerID'" >

            . . .

            <igx-row-island  [height]="null" [key]="'Orders'" (gridCreated)="gridCreated($event)" >

                . . .

            </igx-row-island>

        </igx-hierarchical-grid>

    public gridCreated(event: IGridCreatedEventArgs) {        

            console.log(event.grid);

    }

    Please let me know if you need any further information regarding this matter.

    Regards,
    Monika Kirkova,
    Infragistics