Page 1 of 1

Reacting to List component with multiSelect

Posted: Sun Aug 15, 2021 1:49 pm
by danabrey

Hey!

I'm trying to use a List component to represent a list of options from a resourceStore, a bit like a resourceFilter but with custom handling. However, I can't seem to find a way to react to changes after they've been committed to state. Listening to the onItem event allows me to see this.selected, but this contains the previous state prior to the click of that item.

Is there a better way to access the up to date state on click of an item?

Many thanks


Re: Reacting to List component with multiSelect

Posted: Mon Aug 16, 2021 12:35 pm
by mats

I see the issue yes, we'll look into this: https://github.com/bryntum/support/issues/3294


Re: Reacting to List component with multiSelect

Posted: Mon Aug 16, 2021 12:43 pm
by danabrey

Thanks! Is there any workaround you can think of in the meantime?

Appreciate the reply.


Re: Reacting to List component with multiSelect

Posted: Mon Aug 16, 2021 1:55 pm
by Animal

As a workaround, listen to the change event of the List's selected Collection.

myList.selected.on('change',...)

https://www.bryntum.com/docs/scheduler/#Core/util/Collection#event-change

Really, List should get its own selectionchange event. Grid has one...


Re: Reacting to List component with multiSelect

Posted: Mon Aug 16, 2021 4:47 pm
by danabrey

Ah, thanks for that, didn't know Collections have their own events like that. Cheers.