Dear Team,
In SyncFusion’s element grid I want to present a table.
The table cointains names of employes and the code looks as follows:
the below code giving link on doctor name ..i want to route to the particular doctor on same page on sub-page should appear that page should holding doctor details how to do that..Please see the below image of forgot password subpage.
|
<div class="control-section" style="height: 1000px">
<ejs-grid [dataSource]='data'>
<e-columns>
<e-column field='CustomerName' headerText='Customer Name' width='150'>
<ng-template #template let-data>
<div> // to remove the whitespaces and access the particular element
<a rel='nofollow' rel='nofollow' rel='nofollow' href='#{{data.CustomerName.split(" ").join("")}}'>{{data.CustomerName}}</a>
</div>
</ng-template>
</e-column>
. . .
</e-columns>
</ejs-grid>
</div>
<div id="AntonioMoreno">
Doctors details here
</div> |
|
[App.component.html]
<div class="control-section">
<button (click)="btnClick()">Get Selected records</button>
<ejs-grid #Grid [dataSource]='data'>
<e-columns>
<e-column type='checkbox' width='50'></e-column>
<e-column field='ID' headerText='ID' width='120' textAlign='Right'></e-column>
<e-column field='Doctor' headerText='Doctor Name' width='150'>
</e-column>
</e-columns>
</ejs-grid>
</div> |
|
[App.component.ts]
export class AppComponent implements OnInit {
public data: Object[] = [];
@ViewChild('Grid')
public Grid: GridComponent;
ngOnInit(): void {
this.data =
[{ ID: 10248, Doctor: 'Peter' },
{ ID: 10249, Doctor: 'John' },
{ ID: 10250, Doctor: 'Smith' }];
}
btnClick () {
var ids = [];
// here we can get the selected records of the Grid
console.log(this.Grid.getSelectedRecords());
this.Grid.getSelectedRecords().forEach((e)=>{
ids.push(e["ID"]);
});
alert (ids);
// here you can pass the selected record's IDs to backend
}
} |