PDA

View Full Version : Does beginEdit() still help when using rec.data?



castitas
24 Jan 2014, 1:36 PM
I am familiar with .beginEdit() for records, and how it can speed things up when using rec.set('field', value). Due to a situation that is not my fault, we are using rec.data.field = value. Does .beginEdit() provide the same benefit in this case?

skirtle
25 Jan 2014, 4:31 AM
The performance benefit comes from the 'events' not firing on the store. If you aren't calling set then the events won't be firing anyway.

From a quick look at the code it looks like cancelEdit and endEdit will both still function correctly even if you modify the data directly. It looks to me like the store will still be notified when you call endEdit. If you really don't want to notify the stores of any changes then I'd expect using beginEdit and endEdit to be slower.