Hi, I would like to dynamically fetch row details information from our backend server, but the HttpClient service that is initialized by my component is not available from the initrowdetails() handler – how can I do that?
This is the demo I am following:
angular-grid-rowdetails demo
I would like to modify the initrowdetails:
initrowdetails = (index: any, parentElement: any, gridElement: any, datarecord: any): void => {
console.log(this.httpClient); // this.httpClient undefined!?
this.httpClient.get(apiUrl, {})
.toPromise().then(resp => {
// update parentElement.innerHTML
});
}
My main component has a constructor that initializes the httpClient service:
constructor(private router: Router,
private httpClient: HttpClient) {
console.log(this.httpClient); // correctly prints the obj
}
My question is that if this.httpClient is undefined inside the jqx handler (“this” no longer refers to the main component), how can I get a hold of the main component object within the hander, or how can I fetch data from a url within a jqx handler?
Thanks!