1. #1
    Ext User
    Join Date
    Oct 2007
    Posts
    170
    Vote Rating
    0
    SeaSharp is on a distinguished road

      0  

    Default Why the "delay" settings?

    Why the "delay" settings?


    As I dive deeper into Ext I keep bumping into code that sets a delay parameter or attribute (typically around 100ms). Is the usage of delay a workaround for some internal browser render propagation problem or just a UI fine tuning concept to make the Ext UI feel better?

    For example when configuring a context menu on an Ext Tree why would I need to introduce a 100ms delay on a menu item click event?

  2. #2
    Sencha - Ext JS Dev Team evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    16,645
    Vote Rating
    583
    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 example you've given is probably just for a visual delay.

    A more useful example is when you're catching the window resize event. What I've done in an application is when the window resizes, I also need to resize a few grids. If you catch the resize event with no delay, the window hasn't usually had time to resize by the time you call your grid resize method, so they stay the same size. Add a 100ms delay and the problem goes away.

  3. #3
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    This is sometimes used to handle the fact that some dom updates are async and the delay gives them a chance to complete before something else is done with that element.

  4. #4
    Ext User
    Join Date
    Oct 2007
    Posts
    170
    Vote Rating
    0
    SeaSharp is on a distinguished road

      0  

    Default


    Quote Originally Posted by tryanDLS View Post
    This is sometimes used to handle the fact that some dom updates are async and the delay gives them a chance to complete before something else is done with that element.
    Interesting... Given the case of a simple Ext application that is rendered only through Ext component calls are all DOM sync issues handled internally by Ext? Or put another way, are there outstanding DOM-sync issues that an Ext developer should remain alert to?

  5. #5
    Sencha User
    Join Date
    Mar 2007
    Posts
    7,854
    Vote Rating
    4
    tryanDLS is on a distinguished road

      0  

    Default


    I would think that as you long as you use Ext methods to manipulate the dom, you'll be OK. You could run into problems if you try to directly access/manipulate the dom object yourself in the midst of doing other Ext operations. That being said, I can't tell you which operations are async or not. Jack talked about this in a thread some time ago, maybe he'll chime in at some point with a reference to specific operations.

Thread Participants: 2