question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Using custom filter gives this error "this.customComponent.instance.ngOnChanges is not a function.".

See original GitHub issue

Although my app is running fine but it is showing error.

ERROR TypeError: this.customComponent.instance.ngOnChanges is not a function FilterComponent.html:3 at CustomFilterComponent.ngOnChanges (ng2-smart-table.js:1299) at checkAndUpdateDirectiveInline (core.js:31906) at checkAndUpdateNodeInline (core.js:44367) at checkAndUpdateNode (core.js:44306) at debugCheckAndUpdateNode (core.js:45328) at debugCheckDirectivesFn (core.js:45271) at Object.eval [as updateDirectives] (FilterComponent.html:3) at Object.debugUpdateDirectives [as updateDirectives] (core.js:45259) at checkAndUpdateView (core.js:44271) at callViewAction (core.js:44637)

This is my Custom Button that i am rendering in place of the filter

@Component({ template: <button class="btn btn-md btn-default" style="background-color: #d6d2d2" (click)="onClick('disbursement')">Select Range</button> , })

export class RangeFilterComponent extends DefaultFilter implements OnInit { inputControl = new FormControl(); constructor(private dialogService: NbDialogService) { super(); }

ngOnInit() { }

onClick=(event)=>{ this.dialogService.open(ShowcaseDialogComponent, { context: { title: ‘Select Range’, button: ‘disbursement’ }, }); } }

This is the settings of the table

projectsTableSettings = { hideHeader: false, hideSubHeader: false, add: { addButtonContent: ‘’, createButtonContent: ‘’, cancelButtonContent: ‘’, confirmCreate: true, }, edit: { editButtonContent: ‘’, saveButtonContent: ‘’, cancelButtonContent: ‘’, }, delete: { deleteButtonContent: ‘’, confirmDelete: true, }, actions: { add: false, edit: false, delete: false, }, columns: { name: { title: ‘Project Name’, type: ‘string’, }, description: { title: ‘Description’, type: ‘string’, width: “20%” }, type: { title: ‘Project Type’, type: ‘string’, }, scheme: { title: ‘Scheme’, type: ‘string’, }, assigned_to: { title: ‘Engineer’, type: ‘string’, }, assigned_contractor: { title: ‘Contractor’, type: ‘string’, }, cost_disbursement: { title: ‘Cost Disbursement’, filter: { type: ‘custom’, component: RangeFilterComponent }, width: “10%” }, physical_progress: { title: ‘Physical Progress’, filter: { type: ‘custom’, component: RangeFilterProgressComponent }, width: “10%” }, }, };

Sorry for the bad format. I tried but could not make it right.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
luischueneuiencommented, Jan 7, 2020

Well @PragyanD33p, I don’t know if editing node modules files its a good idea, maybe adding ngOnChanges(changes: SimpleChanges) { if (changes.query) { this.query = changes.query.currentValue; this.inputControl.setValue(this.query); } } to your custom component works

0reactions
PragyanD33pcommented, Jan 7, 2020

Thanks @luischueneuien. Its working. I think its better to keep the node modules untouched. I will close it then.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular4, Getting error f.ngOnChanges is not a function in ...
You need to implement OnChanges interface to use that method: export class CropFormComponent extends Type implements OnChanges { ... }.
Read more >
Detecting @​Input changes in Angular with ngOnChanges ...
In this post you'll learn how to detect changes to an @Input property in Angular. We'll explore both using ngOnChanges lifecycle hook and ......
Read more >
registeronchange is not a function - You.com | The AI Search ...
When I move all the code to a custom component that I hope to use in my forms, I get an error saying...
Read more >
bacali/ng2-smart-table - UNPKG
r\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\r\nthis file except in compliance with the License.
Read more >
angular/angular - Gitter
doeas it possible use pipe for ngModel? for example <input [(ngModel="unitPrice | currency...")]> I've been tried and I see error. I'm not ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found