Success! Looks like we've fixed this one. According to our records the fix was applied for EXTJS-7640 in 4.2.
  1. #1
    Sencha User
    Join Date
    Sep 2009
    Posts
    2
    Vote Rating
    1
    thorn is on a distinguished road

      0  

    Default 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;
                    }
                }
        }
    });

  2. #2
    Sencha User kevin.chen's Avatar
    Join Date
    Sep 2012
    Location
    Redwood City, CA
    Posts
    242
    Vote Rating
    6
    kevin.chen is on a distinguished road

      0  

    Default


    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

  3. #3
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,639
    Vote Rating
    582
    evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute evant has a reputation beyond repute

      0  

    Default


    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!

Thread Participants: 2