1

I use angular4 code more and implemented a dropdown with autocomplete behavior using p-autoComplete from PrimeNG.

On top of this I want to group the items in the dropdown list based on status. Tried using optgroup, but of no luck. Please help me out

eg : a sample JSON of filteredObjects looks like this -

[ "OBJ1","enable"], [ "OBJ2","enable"], [ "OBJ3","disable"], [ "OBJ4","disable"]

 <p-autoComplete [(ngModel)]="selectedObj" [suggestions]="this.filteredObjects" 
                   (completeMethod)="this.updateObject()" 
                    (onClear)="this.updateObject()"
                    (onSelect)="this.updateObject()" 
                    [dropdown]="true" [disabled] = "isActive"
                    id="combobox" [autoHighlight]="true" [inputId]="this.ObjId"
                   [style]="{'width':'100%', 'height':'100%'}" class="p-autocomplete"> 

     <ng-template let-obj pTemplate="item" >             
           {{obj}}                        
     </ng-template>
</p-autoComplete>
Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Maurya
  • 39
  • 5

0 Answers0