This is a migrated thread and some comments may be shown as answers.

JS error when using inside multiple material tabs

6 Answers 425 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Jan
Top achievements
Rank 1
Jan asked on 22 Oct 2019, 01:00 PM

When I use multiple instances of the kendo editor in different material tabs, I get the JS error:

TypeError: Cannot read property 'createElement' of null

https://stackblitz.com/edit/angular-d9rsu8

 

The problem occurs in Chrome and Edge but not in Fireox and also with the latest v8 angular packages.

6 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 24 Oct 2019, 10:21 AM

Hi Jan,

Thank you for the provided example.

Indeed this error is expected. It is caused by the editors (in Second and Third tab) which are not rendered in the DOM yet. Please, check the screenshot.

In fact, there are no rendered editors in the DOM, except the first one. That is why "Cannot read property 'createElement' of null" error is thrown.

In order to avoid initialization of editors that are not currently in the DOM set the iframe option to false:

<mat-tab-group>
      <mat-tab label="First">
        <kendo-editor [iframe]="false" [value]="value"></kendo-editor>
      </mat-tab>
      <mat-tab label="Second">
        <kendo-editor [iframe]="false" [value]="value"></kendo-editor>
      </mat-tab>
      <mat-tab label="Third">
        <kendo-editor [iframe]="false" [value]="value"></kendo-editor>
      </mat-tab>
    </mat-tab-group>

Here is an example

https://stackblitz.com/edit/angular-d9rsu8-3tu5sp?file=app/app.component.ts

I hope this helps.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Itiel
Top achievements
Rank 1
answered on 23 Feb 2020, 09:06 AM

Hi Martin, 

I encountered the same problem. In the documentation, I see that setting [iframe] to "true" causes side effects. ("the Editor will run in style non-encapsulated mode."). I don't want these effects...

I think that this behavior is a bug you need to resolve. It doesn't make sense that an Editor inside a tab throws an exception, no matter where is located.

 

Itiel

0
Itiel
Top achievements
Rank 1
answered on 23 Feb 2020, 09:12 AM
Sorry I mean setting [ifarme] to false..
0
Martin
Telerik team
answered on 25 Feb 2020, 04:15 PM

Hi Itiel,

It seems that the issue is caused by the fact that the Editor is tried to be created in the non-existent container. The Editor used in div with *ngIf directive or Kendo TabStrip component works properly. We guess that there is something specific in the way of how the content of the mat tab is initialized, which is not directly related to Kendo.

I consulted this issue with the assigned developer and I can assure you that we will try to find a way to integrate the Editor component with Angular Material Tab component. Because of technical reasons, currently, we are not sure that this is a bug on our site, but we will try to do our best to make it possible, although we think that there is something specific in the mat tab.

Meanwhile, what I could suggest to you as a workaround is to utilize the Kendo Angular TabStrip component. Please check the attached project. To run the application execute the following command in the root folder:

- npm i

- ng serve

Feel free to contact us if any further questions come up.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Martin
Telerik team
answered on 26 Feb 2020, 02:41 PM

Hi Itiel,

A quick follow up on this case.

After some research on our side, we found what causes the discussed error. Please track the following related GitHub issue:

https://github.com/telerik/kendo-angular/issues/2765

Once fixed the issue will be updated.

Accept our apologies for all the inconvenience caused while the problem is still present.

Regards,
Martin
Progress Telerik

Get quickly onboarded and successful with your Telerik and Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Itiel
Top achievements
Rank 1
answered on 26 Feb 2020, 02:44 PM
Thank you, I'll track this issue
Tags
Editor
Asked by
Jan
Top achievements
Rank 1
Answers by
Martin
Telerik team
Itiel
Top achievements
Rank 1
Share this question
or