akveo / akveo/ng2-smart-table

Class constructor DefaultEditor cannot be invoked without 'new'

Open
#817 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
1.6k
Forks
867
PR merge metrics
No merged PRs in 30d

Description

**I'm submitting a ...** (check one with "x")

* [ ] bug report
* [ ] feature request

### Issue description

**Current behavior:**
I'm trying to implement a custom component for editing a property, but after i click the edit button i'm getting the following error:
```
zone.js:192 Uncaught TypeError: Class constructor DefaultEditor cannot be invoked without 'new'
at new ZoneNameEditorComponent (zone-name-editor.component.ts:17)
```
**Related code:**

This is my code to the custom editor:
```
import {
Component,
OnInit,
ViewChild,
ElementRef,
AfterViewInit
} from '@angular/core';
import { DefaultEditor, Cell } from 'ng2-smart-table';

@Component({
selector: 'zone-name-editor',
templateUrl: './zone-name-editor.component.html',
styleUrls: ['./zone-name-editor.component.scss']
})
export class ZoneNameEditorComponent extends DefaultEditor implements AfterViewInit {
constructor() {
super();
}

ngOnInit() {}
ngAfterViewInit(): void {}
}
```
this is my settings:
```

temp_curr_settings = {
hideHeader: true,
hideSubHeader: true,
actions: {
delete: false
},
add: {
addButtonContent: '',
createButtonContent: '',
cancelButtonContent: '',
confirmCreate: true
},
edit: {
editButtonContent: '',
saveButtonContent: '',
cancelButtonContent: '',
confirmSave: true
},
delete: {
deleteButtonContent: '',
confirmDelete: true
},
columns: {
name: {
title: 'Name',
type: 'string',
editor: {
type: 'custom',
component: ZoneNameEditorComponent,
},
}
}
```

### Other information:

**npm, node, OS, Browser**
```
Angular CLI: 6.0.7
Node: 8.11.3
OS: linux x64
Angular: 6.0.0
... animations, common, compiler, core, forms, http
... language-service, platform-browser, platform-browser-dynamic
... router

Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.0
@angular-devkit/build-angular 0.6.0
@angular-devkit/build-optimizer 0.6.0
@angular-devkit/core 0.6.0
@angular-devkit/schematics 0.6.7
@angular/cdk 6.1.0
@angular/cli 6.0.7
@angular/compiler-cli 6.0.3
@ngtools/webpack 6.0.0
@schematics/angular 0.6.7
@schematics/update 0.6.7
rxjs 6.1.0
typescript 2.7.2
webpack 4.6.0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.