Home » Jquery » javascript – JS: temporarily disable page rendering (possible?)

javascript – JS: temporarily disable page rendering (possible?)

Posted by: admin February 22, 2020 Leave a comment

Questions:

I’m tryin to sort a big html table using JS. It takes a lot of cpu% to rearrange all the rows of this table. I think the big part of this problem is: every time my script moves a pair of rows, the browser starts refreshing the table

So, I’m searching for any way to temporarily tell the browser something like “wait, I’m sorting this table, dont waste CPU for rendering until I’ll finish, plz?”

Basically, I need something lke “Memo1.lines.beginupdate / Memo1.lines.endupdate” in delphi >.<

How to&Answer:

alert(string) stops rendering, and not asyncronous calls, but not loading. You may prompt “too many cells to load, please wait” you may got the desired behavior.
note that, in order to work, string should be a non empty string after trim so a white space is not valid.