Angular 7 & JQWidgets - Export Grid data from another componentangular 2 app component not loadingGet incorrect offsetWidth and offsetHeight valuesHow to get offsetWidth and offsetHeight values after add css class to change themAngular 2 vaadin grid export to excelhow to focus on next input field with press enter key in angular4Using materialize-css (v 1.0.0) in Angular 5 does not workAngular data-grid (ag-grid) sideBar is not workingClass 'NeedAuthGuard' incorrectly implements class 'CanActivate'. Did you mean to extend 'CanActivate' and inherit its members as a subclass?Core module component and Shared module implementation in angularangular :how to rotate an image with animation from component?

Cannot overlay, because ListPlot does not draw same X range despite the same PlotRange

How to extract coefficients of a generating function like this one, using a computer?

Tricky riddle from sister

Other homotopy invariants?

Russian equivalents of 能骗就骗 (if you can cheat, then cheat)

How can solar sailed ships be protected from space debris?

Odd PCB Layout for Voltage Regulator

usage of y" not just for locations?

Is it OK to throw pebbles and stones in streams, waterfalls, ponds, etc.?

Sentences with no verb, but an ablative

Using quotation marks and exclamation marks

Old story where computer expert digitally animates The Lord of the Rings

What type of education should I select in this form?

Did the Shuttle payload bay have illumination?

Emphasize numbers in tables

Why are examinees often not allowed to leave during the start and end of an exam?

What's the difference between the Find Steed and Find Greater Steed spells?

Which are more efficient in putting out wildfires: planes or helicopters?

Is it theoretically possible to hack printer using scanner tray?

What could a Medieval society do with excess animal blood?

How can I change my buffer system for protein purification?

Why should I allow multiple IP addresses on a website for a single session?

Is it OK to say "The situation is pregnant with a crisis"?

Existence of infinite set of positive integers s.t sum of reciprocals is rational and set of primes dividing an element is infinite



Angular 7 & JQWidgets - Export Grid data from another component


angular 2 app component not loadingGet incorrect offsetWidth and offsetHeight valuesHow to get offsetWidth and offsetHeight values after add css class to change themAngular 2 vaadin grid export to excelhow to focus on next input field with press enter key in angular4Using materialize-css (v 1.0.0) in Angular 5 does not workAngular data-grid (ag-grid) sideBar is not workingClass 'NeedAuthGuard' incorrectly implements class 'CanActivate'. Did you mean to extend 'CanActivate' and inherit its members as a subclass?Core module component and Shared module implementation in angularangular :how to rotate an image with animation from component?













0















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?










share|improve this question


























    0















    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?










    share|improve this question
























      0












      0








      0








      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?










      share|improve this question














      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?







      angular angular7 jqwidget






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 25 at 17:23









      lioslios

      12814 bronze badges




      12814 bronze badges




















          1 Answer
          1






          active

          oldest

          votes


















          1














          Updated as per new information:-



          Use one of the https://angular.io/guide/component-interaction models to interact between components.



          Following is the example of template variables.



          Main Component



          //showing only html

          <my-grid #myGrid><my-grid>
          <my-dropdown [grid]="myGrid.jqxGrid"><my-dropdown>


          Component A (my-dropdown)



          Use onSelect and you can pass in your myDropDownList reference as well that way you can pass whatever reference you will



          Bind to the select event of jqxDropDownList.



          import Component from "@angular/core";

          @Component(
          selector: "my-dropdown",
          template: `
          <jqxDropDownList #myDropDownList (onSelect)="exportTo($event)"
          [width]="200" [height]="25" [source]="source" [selectedIndex]="1">
          </jqxDropDownList>
          `
          )

          export class MyDropDown
          @Input() grid: jqxGridComponent
          exportTo(event: any): void

          if (this.grid)
          this.grid.doSomething()



          source: string[] =
          [
          'Affogato',
          'Americano',
          'Bicerin',
          'Breve'
          ];



          Component B - Grid component



          template: `
          <jqxGrid #jqxGrid [theme]="'material'"
          [width]="getWidth()" [source]="dataAdapter" [columns]="columns"
          [pageable]="true" [autoheight]="true" [sortable]="true"
          [altrows]="true" [enabletooltips]="true" [editable]="true"
          [selectionmode]="'multiplecellsadvanced'" [columngroups]="columngroups">
          </jqxGrid>
          `
          export class MyGrid
          @ViewChild('jqxGrid') jqxGrid: jqxGridComponent;






          share|improve this answer

























          • But my Grid is in another component. I want to export data in component A from a component B. How do I write this.myGrid.exportdata differently?

            – lios
            Mar 25 at 18:11











          • Is A to B parent child relationship or they are siblings ?

            – bhantol
            Mar 25 at 18:15











          • They are siblings

            – lios
            Mar 25 at 18:15











          • I updated the answer - but it is just one way to do it but I encourage you to refer to angular.io/guide/component-interaction

            – bhantol
            Mar 25 at 18:25











          • Use @ContntChild

            – bhantol
            May 14 at 13:39










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343343%2fangular-7-jqwidgets-export-grid-data-from-another-component%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          Updated as per new information:-



          Use one of the https://angular.io/guide/component-interaction models to interact between components.



          Following is the example of template variables.



          Main Component



          //showing only html

          <my-grid #myGrid><my-grid>
          <my-dropdown [grid]="myGrid.jqxGrid"><my-dropdown>


          Component A (my-dropdown)



          Use onSelect and you can pass in your myDropDownList reference as well that way you can pass whatever reference you will



          Bind to the select event of jqxDropDownList.



          import Component from "@angular/core";

          @Component(
          selector: "my-dropdown",
          template: `
          <jqxDropDownList #myDropDownList (onSelect)="exportTo($event)"
          [width]="200" [height]="25" [source]="source" [selectedIndex]="1">
          </jqxDropDownList>
          `
          )

          export class MyDropDown
          @Input() grid: jqxGridComponent
          exportTo(event: any): void

          if (this.grid)
          this.grid.doSomething()



          source: string[] =
          [
          'Affogato',
          'Americano',
          'Bicerin',
          'Breve'
          ];



          Component B - Grid component



          template: `
          <jqxGrid #jqxGrid [theme]="'material'"
          [width]="getWidth()" [source]="dataAdapter" [columns]="columns"
          [pageable]="true" [autoheight]="true" [sortable]="true"
          [altrows]="true" [enabletooltips]="true" [editable]="true"
          [selectionmode]="'multiplecellsadvanced'" [columngroups]="columngroups">
          </jqxGrid>
          `
          export class MyGrid
          @ViewChild('jqxGrid') jqxGrid: jqxGridComponent;






          share|improve this answer

























          • But my Grid is in another component. I want to export data in component A from a component B. How do I write this.myGrid.exportdata differently?

            – lios
            Mar 25 at 18:11











          • Is A to B parent child relationship or they are siblings ?

            – bhantol
            Mar 25 at 18:15











          • They are siblings

            – lios
            Mar 25 at 18:15











          • I updated the answer - but it is just one way to do it but I encourage you to refer to angular.io/guide/component-interaction

            – bhantol
            Mar 25 at 18:25











          • Use @ContntChild

            – bhantol
            May 14 at 13:39















          1














          Updated as per new information:-



          Use one of the https://angular.io/guide/component-interaction models to interact between components.



          Following is the example of template variables.



          Main Component



          //showing only html

          <my-grid #myGrid><my-grid>
          <my-dropdown [grid]="myGrid.jqxGrid"><my-dropdown>


          Component A (my-dropdown)



          Use onSelect and you can pass in your myDropDownList reference as well that way you can pass whatever reference you will



          Bind to the select event of jqxDropDownList.



          import Component from "@angular/core";

          @Component(
          selector: "my-dropdown",
          template: `
          <jqxDropDownList #myDropDownList (onSelect)="exportTo($event)"
          [width]="200" [height]="25" [source]="source" [selectedIndex]="1">
          </jqxDropDownList>
          `
          )

          export class MyDropDown
          @Input() grid: jqxGridComponent
          exportTo(event: any): void

          if (this.grid)
          this.grid.doSomething()



          source: string[] =
          [
          'Affogato',
          'Americano',
          'Bicerin',
          'Breve'
          ];



          Component B - Grid component



          template: `
          <jqxGrid #jqxGrid [theme]="'material'"
          [width]="getWidth()" [source]="dataAdapter" [columns]="columns"
          [pageable]="true" [autoheight]="true" [sortable]="true"
          [altrows]="true" [enabletooltips]="true" [editable]="true"
          [selectionmode]="'multiplecellsadvanced'" [columngroups]="columngroups">
          </jqxGrid>
          `
          export class MyGrid
          @ViewChild('jqxGrid') jqxGrid: jqxGridComponent;






          share|improve this answer

























          • But my Grid is in another component. I want to export data in component A from a component B. How do I write this.myGrid.exportdata differently?

            – lios
            Mar 25 at 18:11











          • Is A to B parent child relationship or they are siblings ?

            – bhantol
            Mar 25 at 18:15











          • They are siblings

            – lios
            Mar 25 at 18:15











          • I updated the answer - but it is just one way to do it but I encourage you to refer to angular.io/guide/component-interaction

            – bhantol
            Mar 25 at 18:25











          • Use @ContntChild

            – bhantol
            May 14 at 13:39













          1












          1








          1







          Updated as per new information:-



          Use one of the https://angular.io/guide/component-interaction models to interact between components.



          Following is the example of template variables.



          Main Component



          //showing only html

          <my-grid #myGrid><my-grid>
          <my-dropdown [grid]="myGrid.jqxGrid"><my-dropdown>


          Component A (my-dropdown)



          Use onSelect and you can pass in your myDropDownList reference as well that way you can pass whatever reference you will



          Bind to the select event of jqxDropDownList.



          import Component from "@angular/core";

          @Component(
          selector: "my-dropdown",
          template: `
          <jqxDropDownList #myDropDownList (onSelect)="exportTo($event)"
          [width]="200" [height]="25" [source]="source" [selectedIndex]="1">
          </jqxDropDownList>
          `
          )

          export class MyDropDown
          @Input() grid: jqxGridComponent
          exportTo(event: any): void

          if (this.grid)
          this.grid.doSomething()



          source: string[] =
          [
          'Affogato',
          'Americano',
          'Bicerin',
          'Breve'
          ];



          Component B - Grid component



          template: `
          <jqxGrid #jqxGrid [theme]="'material'"
          [width]="getWidth()" [source]="dataAdapter" [columns]="columns"
          [pageable]="true" [autoheight]="true" [sortable]="true"
          [altrows]="true" [enabletooltips]="true" [editable]="true"
          [selectionmode]="'multiplecellsadvanced'" [columngroups]="columngroups">
          </jqxGrid>
          `
          export class MyGrid
          @ViewChild('jqxGrid') jqxGrid: jqxGridComponent;






          share|improve this answer















          Updated as per new information:-



          Use one of the https://angular.io/guide/component-interaction models to interact between components.



          Following is the example of template variables.



          Main Component



          //showing only html

          <my-grid #myGrid><my-grid>
          <my-dropdown [grid]="myGrid.jqxGrid"><my-dropdown>


          Component A (my-dropdown)



          Use onSelect and you can pass in your myDropDownList reference as well that way you can pass whatever reference you will



          Bind to the select event of jqxDropDownList.



          import Component from "@angular/core";

          @Component(
          selector: "my-dropdown",
          template: `
          <jqxDropDownList #myDropDownList (onSelect)="exportTo($event)"
          [width]="200" [height]="25" [source]="source" [selectedIndex]="1">
          </jqxDropDownList>
          `
          )

          export class MyDropDown
          @Input() grid: jqxGridComponent
          exportTo(event: any): void

          if (this.grid)
          this.grid.doSomething()



          source: string[] =
          [
          'Affogato',
          'Americano',
          'Bicerin',
          'Breve'
          ];



          Component B - Grid component



          template: `
          <jqxGrid #jqxGrid [theme]="'material'"
          [width]="getWidth()" [source]="dataAdapter" [columns]="columns"
          [pageable]="true" [autoheight]="true" [sortable]="true"
          [altrows]="true" [enabletooltips]="true" [editable]="true"
          [selectionmode]="'multiplecellsadvanced'" [columngroups]="columngroups">
          </jqxGrid>
          `
          export class MyGrid
          @ViewChild('jqxGrid') jqxGrid: jqxGridComponent;







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 25 at 18:24

























          answered Mar 25 at 18:02









          bhantolbhantol

          6,3212 gold badges28 silver badges59 bronze badges




          6,3212 gold badges28 silver badges59 bronze badges












          • But my Grid is in another component. I want to export data in component A from a component B. How do I write this.myGrid.exportdata differently?

            – lios
            Mar 25 at 18:11











          • Is A to B parent child relationship or they are siblings ?

            – bhantol
            Mar 25 at 18:15











          • They are siblings

            – lios
            Mar 25 at 18:15











          • I updated the answer - but it is just one way to do it but I encourage you to refer to angular.io/guide/component-interaction

            – bhantol
            Mar 25 at 18:25











          • Use @ContntChild

            – bhantol
            May 14 at 13:39

















          • But my Grid is in another component. I want to export data in component A from a component B. How do I write this.myGrid.exportdata differently?

            – lios
            Mar 25 at 18:11











          • Is A to B parent child relationship or they are siblings ?

            – bhantol
            Mar 25 at 18:15











          • They are siblings

            – lios
            Mar 25 at 18:15











          • I updated the answer - but it is just one way to do it but I encourage you to refer to angular.io/guide/component-interaction

            – bhantol
            Mar 25 at 18:25











          • Use @ContntChild

            – bhantol
            May 14 at 13:39
















          But my Grid is in another component. I want to export data in component A from a component B. How do I write this.myGrid.exportdata differently?

          – lios
          Mar 25 at 18:11





          But my Grid is in another component. I want to export data in component A from a component B. How do I write this.myGrid.exportdata differently?

          – lios
          Mar 25 at 18:11













          Is A to B parent child relationship or they are siblings ?

          – bhantol
          Mar 25 at 18:15





          Is A to B parent child relationship or they are siblings ?

          – bhantol
          Mar 25 at 18:15













          They are siblings

          – lios
          Mar 25 at 18:15





          They are siblings

          – lios
          Mar 25 at 18:15













          I updated the answer - but it is just one way to do it but I encourage you to refer to angular.io/guide/component-interaction

          – bhantol
          Mar 25 at 18:25





          I updated the answer - but it is just one way to do it but I encourage you to refer to angular.io/guide/component-interaction

          – bhantol
          Mar 25 at 18:25













          Use @ContntChild

          – bhantol
          May 14 at 13:39





          Use @ContntChild

          – bhantol
          May 14 at 13:39






          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55343343%2fangular-7-jqwidgets-export-grid-data-from-another-component%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현