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?
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
add a comment |
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
add a comment |
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
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
angular angular7 jqwidget
asked Mar 25 at 17:23
lioslios
12814 bronze badges
12814 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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;
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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;
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
add a comment |
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;
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
add a comment |
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;
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;
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
add a comment |
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
add a comment |
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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