# Sw-select field ändern sich nicht

**URL:** <https://forum.shopware.com/t/sw-select-field-aendern-sich-nicht/100505>\
**Category:** Programmierung\
**Created:** [13. Juli 2023 um 10:21 UTC](https://forum.shopware.com/t/sw-select-field-aendern-sich-nicht/100505 "2023-07-13T10:21:31Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexGalax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/alexgalax/32/9925_2.png) [@AlexGalax](https://forum.shopware.com/u/AlexGalax)\
**Post date:** [13. Juli 2023 um 10:21 UTC](https://forum.shopware.com/t/sw-select-field-aendern-sich-nicht/100505/1 "2023-07-13T10:21:31Z")

</div>

Ich habe Daten in folgendem Format

```js
const groupedOptions = {
    11: {
        id: 11,
        type: 'single',
        label: 'Gruppe 1',
        selected: 113,
        options: [
            {
                id: 111,
                name: 'Option 1.1'
                groupId: 11
            },{
                id: 112,
                name: 'Option 1.2'
                groupId: 11
            }{
                id: 113,
                name: 'Option 1.3'
                groupId: 11
            }
        ]
    },
    22: {
        id: 22,
        type: 'multi',
        label: 'Gruppe 2',
        selected: [222],
        options: [
            {
                id: 221,
                name: 'Option 2.1'
                groupId: 22
            },{
                id: 222,
                name: 'Option 2.2'
                groupId: 22
            }{
                id: 223,
                name: 'Option 2.3'
                groupId: 22
            }
        ]
    }
}

```

Diese loope ich im vue.js twig-Template und blende anhand des `types` entweder ein `single-select` oder `multi-select` ein (vereinfacht):

```html
<template v-for="propertyGroup in groupedOptions">
    <sw-multi-select
        v-if="propertyGroup.type === 'select'"
        v-model="groupedOptions[propertyGroup.id].selected"
        :options="propertyGroup.options"
        @change="changeSelectValue"
    />

    <sw-single-select
        v-else-if="propertyGroup.displayType === 'single'"
        v-model="groupedOptions[propertyGroup.id].selected"
        :options="propertyGroup.options"
        @change="changeSelectValue"
    />
</template>

```

In den Events setze ich dann die Variable, die ich in `v-model` angegeben habe, damit sich der `value`-Wert des Feldes anpasst:

```js
changeSelectValue(newValue){
    const groupId = this.getGroupId(newValue);
    changeSelectValue[groupId].selected = newValue;
}

```

Aber das Select-Feld wird einfach nicht aktualisiert. Im `single-select` bleibt der initale Wert stehen und im `multi-select` kommt kein neuer hinzu. Wenn das `multi-select` aber einmal schließe und wieder öffne, ist aber der Haken an dem neu hinzugefügten Wert:

![1689243384745](https://europe1.discourse-cdn.com/flex013/uploads/shopware/original/3X/a/7/a752f125d3a67f9a80a84ba72520abbd15193f83.png)

Hier sieht man, das Feld hat den Initialen Wert _Leder_ aber die drei hinzugefügten Werte _Plane_, _Polyamid_ und _Nylon_, haben nur einen Haken und sind nicht oben in der Box mit drin.

Ich verstehe wirklich nicht, was ich falsch mache…

---

<div class="post-metadata">

**Author:** ![AlexGalax](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.shopware.com/alexgalax/32/9925_2.png) [@AlexGalax](https://forum.shopware.com/u/AlexGalax)\
**Post date:** [19. Juli 2023 um 04:45 UTC](https://forum.shopware.com/t/sw-select-field-aendern-sich-nicht/100505/2 "2023-07-19T04:45:29Z")

</div>

Kann das jemand reproduzieren oder erkennen, woran das liegt?
