Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

102
Vistas
Manipulating one source list for several dropdowns

In an Angular App I am trying to create selection lists (or maybe dropdowns) which shall all have the same source list. When an item is selected in any of the dropdowns, it should not be available anymore in the source list. So when any of the other dropdowns is opened, this item should not be available for selection anymore.

I have tried so solve this with primeng multiselects and also with simple select and option tags. But every time the problem seems to be the manipulating of the source list. When I remove the item from the source list, the select tag seems kind of to lose the source list and there are no options at all.

I think, what I'm getting wrong, is the filtering ... Here is the code:

<table id="clusters">
<tr *ngFor="let cluster of someService.clustersList; let i = index">
    <input type="text" [value]="cluster.desc">
    <p-multiSelect [options]="someService.sourceList" [(ngModel)]="cluster.items"
        (onChange)="editClusterGroups($event, i)" defaultLabel="Select groups" optionLabel="desc">
    </p-multiSelect>
</tr>
public editClusterGroups(event, i) {

this.someService.sourceList = this.someService.sourceList.filter((el) => {
    if (this.someService.clustersList[i].items.some((item) => item.code !== el.code)) {
        return true
    }
})

}

Got it figured out at least with the filtering. This way it works:

public editClusterGroups(event) {
  this.someService.sourceList = this.someService.sourceList.filter((el) => el.code !== event.itemValue.code) }
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda