Enterprise-ng: Searchfield: Cannot programatically clear Searchfield

Created on 18 Jun 2020  路  4Comments  路  Source: infor-design/enterprise-ng

Describe the bug
calling clear method of SohoToolbarFlexSearchFieldComponent or SohoToolbarSearchFieldComponent results in

for SohoToolbarFlexSearchFieldComponent
ERROR TypeError: Cannot read property 'clear' of undefined at ids-enterprise-ng.js:19407 at ZoneDelegate.invoke (zone-evergreen.js:359) at Zone.run (zone-evergreen.js:124) at NgZone.runOutsideAngular (core.js:39572) at SohoToolbarSearchFieldComponent.clear (ids-enterprise-ng.js:19407) at ViewToolbarComponent.set searchTerm [as searchTerm] (view-toolbar.component.ts:41) at updateProp (core.js:32189) at checkAndUpdateDirectiveInline (core.js:31867) at checkAndUpdateNodeInline (core.js:44367) at checkAndUpdateNode (core.js:44306)

and for SohoToolbarSearchFieldComponent

OverviewComponent.html:1 ERROR TypeError: Cannot read property 'clear' of undefined at ids-enterprise-ng.js:19407 at ZoneDelegate.invoke (zone-evergreen.js:359) at Zone.run (zone-evergreen.js:124) at NgZone.runOutsideAngular (core.js:39572) at SohoToolbarSearchFieldComponent.clear (ids-enterprise-ng.js:19407) at ViewToolbarComponent.set searchTerm [as searchTerm] (view-toolbar.component.ts:41) at updateProp (core.js:32189) at checkAndUpdateDirectiveInline (core.js:31867) at checkAndUpdateNodeInline (core.js:44367) at checkAndUpdateNode (core.js:44306)

To Reproduce
Steps to reproduce the behavior:

  1. Go to example application (e.g. toolbar-flex-basic.demo.html
  2. programatically call .clear method e.g.
  @ViewChild(SohoToolbarFlexSearchFieldComponent) component: SohoToolbarFlexSearchFieldComponent;

 ngAfterViewInit() {
   setTimeout(() => {
     this.component.clear();
   }, 5 * 1000);
 }
  1. See error

Expected behavior
A clear and concise description of what you expected to happen.

Version

  • ids-enterprise-ng: 6.4.x, 7.x.x

Screenshots
If applicable, add screenshots to help explain your problem.

Platform

  • Device (if applicable) [e.g. iPhone 6 or Samsung Galaxy S6]
  • OS Version: [e.g. Windows 10 or iOS 8]
  • Browser Name [e.g. chrome, safari, stock browser]
  • Browser Version [e.g. 22, 66.0.3359.181 (Official Build) (64-bit)]

Additional context
Add any other context about the problem here.

[1] type

All 4 comments

also when ngModel used and value set to an empty string, the clear icon stays
image

Interesting... We just added this to the EP component https://github.com/infor-design/enterprise/pull/4048
So this should now be there. But not sure why the type was there before.

Assigning @ericangeles to take a look this sprint sometime as this was recently completed

@tmcconechy @Fruko I've tried this and it's working when calling it on afterInit. I'll create a test page for this. I basically just clean the dependencies and install it again.

This issue is now resolved.

Was this page helpful?
0 / 5 - 0 ratings