Property 'ej2_instances' does not exist on type 'Element'.' does not exist on type 'Element'

Hi all,

my work use kanban controller and i want to do this
https://stackblitz.com/edit/wgeifm?file=index.ts


but it's not work because 

**Property 'ej2_instances' does not exist on type 'Element'.' does not exist on type 'Element'**


how to fix it. this is my code in angular and typescript
Image_8551_1692786311492

Image_3913_1692786377553

Image_5997_1692786403355

Image_1179_1692786543160

Image_8311_1692786502045

version is Image_4050_1692786609295

Thanks and best regards


1 Reply 1 reply marked as answer

GD Gokulraj Devarajan Syncfusion Team August 28, 2023 03:31 AM UTC

We have validated your query. The error occurs because the Element does not have the property of ej2_instances. You can create an interface that extends the Element interface and includes the ej2_instances. Please find the below sample for your reference.

Code Snippet:

import { KanbanCardRenderedEventArgs } from '@syncfusion/ej2-kanban';
import { extend } from '@syncfusion/ej2-base';
import * as dataSource from './datasource.json';
/**
 * Kanban Default Sample
 */

// To maintain the property changes, extend the object.
interface CustomElement extends Element {
  ej2_instancesany[]; // Adjust the type of ej2_instances as needed
}
let dataObject[] = <Object[]>(
  extend([], (dataSource as any).kanbanDatanulltrue)
);
```
let isInitialRenderboolean = true;
function dataBound(): void {
  if (isInitialRender) {
    let card = kanbanObj.element.querySelectorAll('.e-card');
    for (var j = card.length - 1j >= 0j--) {
      ((card[jas CustomElement).ej2_instances[0as any).enableTailMode = false;
    }
    this.isInitialRender = false;
  }
}
function cardRendered(argsCardRenderedEventArgs): void {
  if (!isInitialRender) {
    (args.element as CustomElement).ej2_instances[0].enableTailMode = false;
  }
}


Sample: 

https://stackblitz.com/edit/wgeifm-c9mnvx?file=index.ts 



Marked as answer
Loader.
Up arrow icon