I am experimenting with Angular 7 and JQWidgets. I am working on Grid component and want to export Grid's data from another component called settings. I worked on the demo (available here) and I created the following component:
import { Component, ElementRef, Input, AfterViewInit, ViewChild} from '@angular/core';
import { jqxDropDownListComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxdropdownlist';
import { jqxGridComponent } from 'jqwidgets-scripts/jqwidgets-ts/angular_jqxgrid';
@Component({
selector: 'app-mydemo',
templateUrl: './mydemo.component.html'
})
export class MydemoComponent{
@ViewChild('myGrid') myGrid: jqxGridComponent;
@ViewChild('myDropDownList') myDropDownList: jqxDropDownListComponent;
exportFiletype: any;
constructor() { }
exportBtnOnClick() {
this.exportFiletype = this.myDropDownList.getSelectedItem().value;
switch (this.exportFiletype) {
case 'Excel':
this.myGrid.exportdata('xls', 'jqxGrid', true, null, true, 'https://jqwidgets.com/export_server/dataexport.php');
break;
case 'CSV':
this.myGrid.exportdata('csv', 'jqxGrid', true, null, true, 'https://jqwidgets.com/export_server/dataexport.php');
break;
};
};
}
My problem is with this.myGrid referrring to the Grid in the other component. How can I refer straight to it?