-
29 Oct 2012 10:00 AM #1
form.field.Display with form.loadRecord slowly
form.field.Display with form.loadRecord slowly
This may be a bug - or a request for easier handling.
If you create a large form with many displayfields (xtype:displayfield) and load a record into this form via .loadRecord() the load process will be very slow (e.g. avg. of 3 seconds for to load 20 fields)!
Why?
Because:
- loadRecord() calls each setValue() function on each field (correct)
- setValue() calls setRawValue() and further events (correct)
- setRawValue() set the raw value (correct)
- in case of the displayfield, the innerHTML will be rendered and updateLayout() called (weird)
So you can watch to every field update because the form layout will be regenerated at many times during the load process.
This solution will work for me:
Code:Ext.define('Ext.form.Basic', { override: 'Ext.form.Basic', loadRecord: function(record) { this._record = record; var items = this._fields.items; for(var it in items) { var item = items[it]; if(typeof item.name != 'undefined' && typeof record.data[item.name] != 'undefined') { item.suspendLayout = true; item.setValue(record.data[item.name]); item.suspendLayout = false; } } } });
-
29 Oct 2012 11:56 AM #2
Would you please let us know in which ExtJs version you have this issue? If possible, could you please follow this link to submit bug http://www.sencha.com/forum/showthre...o-report-a-bug
-
29 Oct 2012 3:02 PM #3
The reason it triggers an updateLayout when you change the value is that it can change the size of the field (say, if the content has html and line wraps).
But I agree, it should batch all the pending layouts at the end.Evan Trimboli
Sencha Developer
Twitter - @evantrimboli
Don't be afraid of the source code!
Success! Looks like we've fixed this one. According to our records the fix was applied for
EXTJSIV-7640
in
4.2.


Reply With Quote