We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

How to share data from a selected row from a data grid to another

Hi team,

I need to pass data from a selected row on the syncfusion data grid to child component (I'm using Angular 7) and I'm wondring if syncfusion got it's own methods or do I just use @Input/@Output from angular? I hope you can share some examples if possbile.

3 Replies

TS Thavasianand Sankaranarayanan Syncfusion Team December 11, 2018 04:56 AM UTC

Hi Ali, 

Thanks for contacting Syncfusion support. 

As per your given detail we suspect that you want to update the other Grid dataSource when we select a row in a Grid. 

We have already discuss about the above mention query in the following Online sample. 


Regards, 
Thavasianand S. 



AJ AJ December 19, 2018 08:01 PM UTC

Thanks team for your help.

I have another question and it's regarding rowSelecting() and rowSelected() in Angular 7, how I can use the both function inside  ngOnInit() ? as I have other functions that online work inside the lifecycle hook .

Cheers


MS Madhu Sudhanan P Syncfusion Team December 20, 2018 09:07 AM UTC

Hi Ali, 

Thanks for the update. 

The rowSelected and rowSelecting are event of the grid component which can be registered to the grid using () method in the component template.  


<ejs-grid . . .  (rowSelecting)="rowSelecting($event)"> 
    . . . .  
</ejs-grid> 



It is not possible to register them inside the ngOnInit event as the grid is not initialized. If you want to bind the event handlers programmatically then please use ngViewAfterInit hook to bind the event as follows. 


export class DefaultComponent implements OnInit { 
    public data: Object[] = []; 
    @ViewChild('grid') 
    public grid: GridComponent; 
    ... 
 
    ngAfterViewInit(): void { 
      this.grid.rowSelecting.subscribe((e) => console.log('rowSelecting')); 
      this.grid.rowSelected.subscribe((e) => console.log('rowSelected')); 
    } 
} 



If we misunderstood your requirement then please provide more information regarding your requirement. 

Regards, 
Madhu Sudhanan P 


Loader.
Up arrow icon