message

Discussion in 'Javascript' started by mike, Dec 5, 2005.

  1. mike

    mike Guest

    I have a page that generates content in a <tbody></tbody> dynamically.

    The thing is if there is about 167 or so records it takes some time to
    render them so I put a tag like:

    <div id="str_status"> </div>

    and in my js I have

    function blah()
    {
    document.getElementById("srt_status").innerHTML = "rendering";
    ..
    ..
    ..some code here that takes a bit of time
    ..
    ..
    document.getElementById("srt_status").innerHTML = "";
    }

    Problem is I never see the "rendering" ..... Looks like it renders all
    at once and is not updating as the steps occur.

    Any thoughts?

    Mike
    mike, Dec 5, 2005
    #1
    1. Advertising

  2. mike

    Ivo Guest

    "mike" wrote
    > I have a page that generates content in a <tbody></tbody> dynamically.
    > The thing is if there is about 167 or so records it takes some time to
    > render them so (...) in my js I have
    >
    > function blah()
    > {
    > document.getElementById("srt_status").innerHTML = "rendering";
    > .
    > .some code here that takes a bit of time
    > .
    > document.getElementById("srt_status").innerHTML = "";
    > }
    >
    > Problem is I never see the "rendering" ..... Looks like it renders all
    > at once and is not updating as the steps occur.


    That 's right. And in the main we 're only glad that no time in between is
    wasted on useless redrawings. To tell the machine that you 're looking for
    such intermediate update, you could employ a setTimeout:

    function blah()
    {
    document.getElementById("srt_status").innerHTML = "rendering";
    window.setTimeout( 'proceed();', 10 );
    }

    function proceed()
    {
    ..
    ..some code here that takes a bit of time
    ..
    document.getElementById("srt_status").innerHTML = "";
    }

    The minimum amount of waiting time (10 ms. in the code above) needed for the
    effect to succeed, varies from machine to machine. I have found that a
    Timeout of 1 ms is too short in some situations, but 50 or 100 is much more
    than enough.
    hth
    ivo
    http://4umi.com/
    Ivo, Dec 5, 2005
    #2
    1. Advertising

  3. mike

    Danny Guest

    Roughly knowing little of what you have, I'd say is some runtime
    issue, some process might be overriding the "rendering" part or
    conflicting it, OR is just your timing doesn't allow for a screen
    painting of the text long enough to be viewable.



    Danny
    Danny, Dec 6, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?bWc=?=
    Replies:
    1
    Views:
    2,120
    Marshal Antony
    Feb 8, 2004
  2. =?Utf-8?B?bWc=?=

    Size of e-mail message - message.Body = msgText

    =?Utf-8?B?bWc=?=, Feb 10, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    557
    Chad Z. Hower aka Kudzu
    Feb 11, 2004
  3. - Steve -
    Replies:
    0
    Views:
    696
    - Steve -
    Jul 6, 2004
  4. tshad
    Replies:
    0
    Views:
    783
    tshad
    Jan 27, 2005
  5. Hari Om
    Replies:
    3
    Views:
    12,107
    Wendy S
    Oct 1, 2003
Loading...

Share This Page