View Full Version : Scope problem defining a listener for store

15 Aug 2011, 10:46 PM

I want to get any changes in a store (with a listener) to refresh my grid when something changes. Thats my code:

//record model object with a reference to appointment (hasMany)
record.appointment().on('datachanged', appointmentController.reloadGridData, appointmentController, {record: record});

So i get the Appointment-Store with record.appointment() and define a listener on it. After this line the store is filled up with the data and everything works fine.

BUT :-) If there is another call of the listener the record object is the actual model but a store.
I also tried to set the record (model) as scope and to define the controller as function parameter. In this case the record object is the one i need but i don't get the controller.

So, what do you think about my problems? Wich of my approches is good and whats absolutely nonsens?

Thanks in advance