How to disable deselection of items in ListView?

UI Components for Vue
Post Reply
willie68
Posts: 1
Joined: 26 Feb 2021, 12:44

16 Mar 2021, 19:32

Hi,
i'm new to PrimeVue 3. I just build up a little admin interface for my ReCoS project and came across this question, where i didn't found a solution. Maybe someone can help me.
How to disable deselection of items in ListView?
I have a Listview

Code: Select all

        <Listbox
          v-model="activeAction"
          :options="profile.actions"
          optionLabel="name"
          listStyle="max-height:500px"
          class="no-border"
          v-on:change="checkChange($event)"
        >
        </Listbox>
and i want to deactivate the deselction of the items. Every time one item should be selected. Programatically i select the first item on changing the underlying list. There is only one exception, if there is no item in the list. How can I achieve this?

avenmore
Posts: 17
Joined: 09 Nov 2020, 07:03

16 Mar 2021, 22:07

As far as I know there isn't a way. I hacked it by listening to the @change event, storing the last selection, and if it gets changed to null then resetting it back to the last selection.

Post Reply

Return to “PrimeVue”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests