Results 1 to 4 of 4

Thread: Combobox setReadOnly() function too slow!

  1. #1
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    23
    Answers
    1

    Question Answered: Combobox setReadOnly() function too slow!

    Extjs Version: 4.1.0

    I was wondering why the setReadOnly() function is so slow.

    When you use setReadOnly() on a combo box, it has to re-render it in order to remove the trigger button.

    It takes about 2 or 3 seconds for this for loop to finish with a mere 6 items and render it to the screen...

    Code:
            
    var cq = Ext.ComponentQuery;
    var comboboxes = cq.query( "invenform combobox" );
            
    for( var i = 0; i < comboboxes.length; i++ ){
          comboboxes[ i ].setReadOnly( false ); 
          comboboxes[ i ].forceSelection = true; 
    };
    I was wondering if anyone had any ideas as to why this is so slow. Am I doing something inefficient? Is it the rendering that takes so long? Is Extjs 4's setReadOnly() function just not optimized?

    Thanks.

  2. Have you tried using suspendLayouts on your container?

    form.suspendLayouts()
    // update fields
    form.resumeLayouts(true);
    form.doLayout()

    there is also a global version Ext.suspendLayouts()

    Scott.

  3. #2
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    23
    Answers
    1

    Default

    Update:

    So, it turns out that any textfield takes quite a bit of time to process when using setReadOnly(), not just the comboboxes.

  4. #3
    Sencha - Support Team scottmartin's Avatar
    Join Date
    Jul 2010
    Location
    Houston, Tx
    Posts
    9,410
    Answers
    716

    Default

    Have you tried using suspendLayouts on your container?

    form.suspendLayouts()
    // update fields
    form.resumeLayouts(true);
    form.doLayout()

    there is also a global version Ext.suspendLayouts()

    Scott.

  5. #4
    Touch Premium Member
    Join Date
    Jun 2011
    Posts
    23
    Answers
    1

    Default

    Thanks Scott! It works like a charm.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •