- Home
- Forum
- Angular - EJ 2
- Error thrown when hidemedia is enabled
Error thrown when hidemedia is enabled
Hello,

Using 17.3.14 I get the following error
steps to reproduce
1. Create two grids on same page that can be toggled on and off (ngif) and add hideAtMedia="(min-width: 600px)" to a column on grid 1
2. resize grid 1 a couple times so it falls below 600, then toggle to grid2 and start resizing, you will get the above error b/c the media query keeps the old grids reference but cant find the columns of grid 1 b/c it is no longer available
SIGN IN To post a reply.
3 Replies
PS
Pavithra Subramaniyam
Syncfusion Team
October 7, 2019 12:37 PM UTC
Hi Moses,
Thanks for contacting Syncfusion support.
Based on your query, we suspect that Grid 1 id was maintained on the Grid 2 while toggling. While performing toggle operation we have to destroy the grid or change the display style as ‘none’ to avoid duplicate reference. we suggest you to use the below way to achieve your requirement. Please refer the below code example and sample link for more information.
Regards,
Pavithra S.
Hi Moses,
Thanks for contacting Syncfusion support.
Based on your query, we suspect that Grid 1 id was maintained on the Grid 2 while toggling. While performing toggle operation we have to destroy the grid or change the display style as ‘none’ to avoid duplicate reference. we suggest you to use the below way to achieve your requirement. Please refer the below code example and sample link for more information.
Regards,Pavithra S.
I don't think this is the issue because it happens if I have a single grid on a page(component) and navigate away to a different page and come back to the page. Regardless if I do something like the following or not.
ngOnDestroy(): void {
this.grid.destroy();
}
It seems like using hideAtMedia has an issue where it does not removeaListener after it has been added
The following code in grids/src/grid/base/grid.ts adds a listener to a column, and that function gets hit each time however I don't see a place where the listener gets removed on grid destroy
private pushMediaColumn(col: Column, index: number): void {
this.mediaCol.push(col);
this.media[col.uid] = window.matchMedia(col.hideAtMedia);
this.mediaQueryUpdate(index, this.media[col.uid]);
this.media[col.uid].addListener(this.mediaQueryUpdate.bind(this, index));
}
PS
Pavithra Subramaniyam
Syncfusion Team
October 8, 2019 12:39 PM UTC
Hi Moses,
Thanks for sharing the details.
We are able to reproduce the reported issue at our end. We have logged a bug report for the reported issue as “Error thrown when hidemedia is enabled”. Thank you for taking time to report this issue and helping us improve our product. At Syncfusion, we are committed to fixing all validated defects (subject to technological feasibility and Product Development Life Cycle ) and including the defect fix in our upcoming October 30 Patch Release.
Until then we appreciate your patience.
You can now track the current status of your request, review the proposed resolution timeline, and contact us for any further inquiries through this link.
Note: Above feedback link is under review, once approved it will be visible.
Regards,
Pavithra S.
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
MF Moses Fetters
- Oct 4, 2019 11:27 PM UTC
- Oct 8, 2019 12:39 PM UTC