Extjs Load Mask while long processing

前端 未结 2 915
说谎
说谎 2020-12-16 21:05

I have problems setting load mask on panel properly. After click on a button the new tree store is being generated (localy) and it takes quite some time. The load mask shows

2条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-16 21:25

    The reason for that is quite simple - JS is single threaded*. If you modify DOM (for example by turning mask on) the actual change is made immediately after current execution path is finished. Because you turn mask on in begining of some time-consuming task, browser waits with DOM changes until it finshes. Because you turn mask off at the end of method, it might not show at all. Solution is simple - invoke store rebuild after some delay.

    Working sample: http://jsfiddle.net/25z3B/2/

    *If you want to have true multi threading see web workers

提交回复
热议问题