primeng icon indicating copy to clipboard operation
primeng copied to clipboard

onFocus event not working in Primng Autocomplete

Open smtgpt62 opened this issue 9 years ago • 7 comments

Hi , I am trying to use onFocus() event of Autocomplete , but the event is not getting fired even if the aucomplete box gets focus.

Also I am trying to make the make the input box look red when the list is empty according to the typed characters, it is working fine , but when i am clearing the box with backspace then the color of the box is red even if the input box is empty.

smtgpt62 avatar Mar 06 '17 12:03 smtgpt62

I think the best way to get it looked at/resolved is to follow the issue logging guidelines and include plunkr showing your problem.

external-olgierd avatar Mar 06 '17 12:03 external-olgierd

I tried it locally and everything seems working fine try it like this.

<p-autoComplete [(ngModel)]="country" [suggestions]="filteredCountriesSingle" (completeMethod)="filterCountrySingle($event)" field="name" [size]="30"
    placeholder="Countries" [minLength]="1" (onFocus)="test()"></p-autoComplete>

Mrtcndkn avatar Mar 07 '17 12:03 Mrtcndkn

For me it does not work either. I'm using it with reactive form.

<p-autoComplete
  [formControl]="searchControl"
  [suggestions]="searchResults"
  (completeMethod)="search($event)"
  (onFocus)="focus()"
></p-autoComplete>

Update: with PrimeNG version 2.0.1 it was not working but I tried to update to 2.0.2 and it works like a charm now.

kuldarim avatar Mar 08 '17 05:03 kuldarim

Glad to hear that.

Mrtcndkn avatar Mar 08 '17 07:03 Mrtcndkn

working perfectly on version ˆ2.0.4.

nashmaniac avatar Mar 18 '17 07:03 nashmaniac

I have same problem version 4.X but also not working(angular4.x)

<div class="col-md-6 form-group"> <label class="control-label">* Business type</label> <p-autoComplete #orgtype="ngModel" name="orgtype" [suggestions]="organization_type_list" [(ngModel)]="selected_organization_type" (completeMethod)="searchOrganizationType($event)" (focus)="totla()" field="name" placeholder="Organization type" [size]="50" [minLength]="1" required> </p-autoComplete> <div *ngIf="orgtype.invalid && (orgtype.dirty || orgtype.touched)" class="text-danger"> <div *ngIf="orgtype.errors.required"> Business type is required.</div> </div> </div>

padmarao123 avatar Dec 12 '17 11:12 padmarao123

OnFocus() event is not working on Primeng Listbox.

<p-listbox [options]="rentalLocationsName" [(ngModel)]="selectedLocation" (onFocus)="onDropdownFocus()" (onBlur)="onBlurMouse()" [filter]="true" [style]="{ width: '15rem' }" [listStyle]="{'max-height': '220px'}">

onDropdownFocus() { console.log('Dropdown focused!'); }

sarangrajan948 avatar Apr 25 '24 07:04 sarangrajan948