PDA

View Full Version : StoreListeners need PropertyChangeEvents



Grandiosa
10 Jul 2008, 4:01 AM
I think StoreListeners should be able to determine which property that changed on the model. A controller need this to do necessary RPC calls based on certain property changes, such as model.setActive() etc.

Today a StoreListener receives a StoreEvent, which extends BaseEvent and not ChangeEvent.
The StoreEvent contains the updated model object and a record object. But the record cannot be used to determine changes because it's already committed (the StoreListener is invoked from Record.afterCommit )

There are other ways to achieve this, like registering ChangeListeners on all the Store's models, or setting up a PropertyChangeEvent yourself in the listener for the Store's widget.

But I think it should be possible to do this clean and easy in a StoreListener residing in your controller, where also the Store itself is typically hosted.

zaccret
11 Jul 2008, 4:44 AM
Mmm, I'm not sure it is the purpose of the Store to tell which Model property has changed :-?