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. Advertisements

  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. Advertisements

  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. Advertisements

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,376
    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:
    736
    Chad Z. Hower aka Kudzu
    Feb 11, 2004
  3. - Steve -
    Replies:
    0
    Views:
    846
    - Steve -
    Jul 6, 2004
  4. tshad
    Replies:
    0
    Views:
    994
    tshad
    Jan 27, 2005
  5. Hari Om
    Replies:
    3
    Views:
    12,893
    Wendy S
    Oct 1, 2003
  6. rabbits77
    Replies:
    0
    Views:
    1,109
    rabbits77
    Feb 26, 2004
  7. Joos Nielsen
    Replies:
    2
    Views:
    1,168
    Ryan Stewart
    Jun 4, 2004
  8. kelvinq
    Replies:
    0
    Views:
    459
    kelvinq
    Aug 13, 2004
Loading...