Alpha Software Mobile Development Tools:   Alpha Anywhere    |   Alpha TransForm subscribe to our YouTube Channel  Follow Us on LinkedIn  Follow Us on Twitter  Follow Us on Facebook

Announcement

Collapse

The Alpha Software Forum Participation Guidelines

The Alpha Software Forum is a free forum created for Alpha Software Developer Community to ask for help, exchange ideas, and share solutions. Alpha Software strives to create an environment where all members of the community can feel safe to participate. In order to ensure the Alpha Software Forum is a place where all feel welcome, forum participants are expected to behave as follows:
  • Be professional in your conduct
  • Be kind to others
  • Be constructive when giving feedback
  • Be open to new ideas and suggestions
  • Stay on topic


Be sure all comments and threads you post are respectful. Posts that contain any of the following content will be considered a violation of your agreement as a member of the Alpha Software Forum Community and will be moderated:
  • Spam.
  • Vulgar language.
  • Quotes from private conversations without permission, including pricing and other sales related discussions.
  • Personal attacks, insults, or subtle put-downs.
  • Harassment, bullying, threatening, mocking, shaming, or deriding anyone.
  • Sexist, racist, homophobic, transphobic, ableist, or otherwise discriminatory jokes and language.
  • Sexually explicit or violent material, links, or language.
  • Pirated, hacked, or copyright-infringing material.
  • Encouraging of others to engage in the above behaviors.


If a thread or post is found to contain any of the content outlined above, a moderator may choose to take one of the following actions:
  • Remove the Post or Thread - the content is removed from the forum.
  • Place the User in Moderation - all posts and new threads must be approved by a moderator before they are posted.
  • Temporarily Ban the User - user is banned from forum for a period of time.
  • Permanently Ban the User - user is permanently banned from the forum.


Moderators may also rename posts and threads if they are too generic or do not property reflect the content.

Moderators may move threads if they have been posted in the incorrect forum.

Threads/Posts questioning specific moderator decisions or actions (such as "why was a user banned?") are not allowed and will be removed.

The owners of Alpha Software Corporation (Forum Owner) reserve the right to remove, edit, move, or close any thread for any reason; or ban any forum member without notice, reason, or explanation.

Community members are encouraged to click the "Report Post" icon in the lower left of a given post if they feel the post is in violation of the rules. This will alert the Moderators to take a look.

Alpha Software Corporation may amend the guidelines from time to time and may also vary the procedures it sets out where appropriate in a particular case. Your agreement to comply with the guidelines will be deemed agreement to any changes to it.



Bonus TIPS for Successful Posting

Try a Search First
It is highly recommended that a Search be done on your topic before posting, as many questions have been answered in prior posts. As with any search engine, the shorter the search term, the more "hits" will be returned, but the more specific the search term is, the greater the relevance of those "hits". Searching for "table" might well return every message on the board while "tablesum" would greatly restrict the number of messages returned.

When you do post
First, make sure you are posting your question in the correct forum. For example, if you post an issue regarding Desktop applications on the Mobile & Browser Applications board , not only will your question not be seen by the appropriate audience, it may also be removed or relocated.

The more detail you provide about your problem or question, the more likely someone is to understand your request and be able to help. A sample database with a minimum of records (and its support files, zipped together) will make it much easier to diagnose issues with your application. Screen shots of error messages are especially helpful.

When explaining how to reproduce your problem, please be as detailed as possible. Describe every step, click-by-click and keypress-by-keypress. Otherwise when others try to duplicate your problem, they may do something slightly different and end up with different results.

A note about attachments
You may only attach one file to each message. Attachment file size is limited to 2MB. If you need to include several files, you may do so by zipping them into a single archive.

If you forgot to attach your files to your post, please do NOT create a new thread. Instead, reply to your original message and attach the file there.

When attaching screen shots, it is best to attach an image file (.BMP, .JPG, .GIF, .PNG, etc.) or a zip file of several images, as opposed to a Word document containing the screen shots. Because Word documents are prone to viruses, many message board users will not open your Word file, therefore limiting their ability to help you.

Similarly, if you are uploading a zipped archive, you should simply create a .ZIP file and not a self-extracting .EXE as many users will not run your EXE file.
See more
See less

does anyone know of an alternative to refresh the screen

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    does anyone know of an alternative to refresh the screen

    Currently; I'm using

    <meta http-equiv="refresh" content="20">
    to refresh the screen every 20 seconds.

    but this is not working because everytime it refreshes, it takes you back to page1, if you are looking at page 9 for example, it jumps you back to the starting point.

    What would be the alternative to refresh the data on the GRID and keeping the same page you are viewing ?

    Thanks

    #2
    Re: does anyone know of an alternative to refresh the screen

    With v10, you can do this:

    Code:
    MYGRID_GridObj.refresh();
    Where "MYGRID" is the name of your grid e.g., "GRID1", etc.
    -Steve
    sigpic

    Comment


      #3
      Re: does anyone know of an alternative to refresh the screen

      Steve;

      does this go on a button on a page to manually refresh or is there a way to time it without user intervention ?

      Comment


        #4
        Re: does anyone know of an alternative to refresh the screen

        Sorry for the delay. I wanted to put together a tested example, but my javascript knowledge is falling short. Maybe someone else can jump in to help. Here's what I have:

        (1) You need a function that will call itself every n milliseconds. Here's an example:

        Code:
        <script type="text/javascript">
        var timer_is_on=0;
        function doTimer()
        {
        if (!timer_is_on)
          {
        	//alert("Timer is too running");
        	GRID1_GridObj.refresh();
        	t=setTimeout("doTimer()",1000);
          }
        }
        </script>
        This works if you uncomment the alert and comment out the GRID1... line. In the sample page I worked with, I made sure the grid Alias is "GRID1".

        (2) You can load this function in the <body> tag.

        Code:
        <body onload="doTimer()">
        --------------

        But, this doesn't work. I know I can use an AJAX callback page with the GRID1_GridObj.refresh(); syntax, but I don't know how to make it work in the function. Anybody who knows can jump in here?
        -Steve
        sigpic

        Comment


          #5
          Re: does anyone know of an alternative to refresh the screen

          Anybody who knows can jump in here?
          I'd like to think I qualify here. :-)

          Suggest the var t is global to the script||page
          next call set the timer globally.
          Next in the function, clear the timer then reset it, simply to clear the nastiness of recursion and possible leaks.
          -
          Note problem: due to the asynchronous nature of javascript, What would happen if the page refresh took longer than the 1000 milisecs,
          Answer, A queue of events would form. (this could get ugly)
          Thus somehow, the refresh complete or Navigate2 event should be captured and the timer is then reset from that. [I'm unsure how to capture this or assign an event handler, but I'm sure its possible.]

          Code:
          <script type="text/javascript">
          var t;
          t=setTimeout("doTimer()",1000);
          
          function doTimer()
          {
                       clearTimeout(t);
          	GRID1_GridObj.refresh();
          	t=setTimeout("doTimer()",1000);
          
          }
          </script>

          Comment


            #6
            Re: does anyone know of an alternative to refresh the screen

            1000 milliseconds is clearly too fast for this purpose. Making it slower or modifying as you suggested is definitely in order.

            The bigger problem with this code is that the .refresh() isn't working - Firebug show the error clearly that Grid1 is not found.
            -Steve
            sigpic

            Comment


              #7
              Re: does anyone know of an alternative to refresh the screen

              Thanks a lot guys,
              does this code go in the BODY of the page that has the component ?
              If so and the page has more than one component, you still have to refresh each component ?

              Comment


                #8
                Re: does anyone know of an alternative to refresh the screen

                I don't believe we have an answer yet. Javascript functions go in the <head> part of the page.

                The <body> part I showed you is just an addition to your existing <body> tag.

                And, yes, if you have more than one grid to refresh, then you'd issue the .refresh() to each of them.

                But we still don't have working .refresh() code.

                Anyone?
                -Steve
                sigpic

                Comment


                  #9
                  Re: does anyone know of an alternative to refresh the screen

                  Apologies guys I'm working code blind. As I don't yet have v10 installed.
                  -
                  The bigger problem with this code is that the .refresh() isn't working - Firebug show the error clearly that Grid1 is not found.
                  -
                  Most likely candidates fo this error are
                  a) The Javascript is calling Grid1 before it has been inserted into the DOM.
                  b) Grid1 name is wrong, (remember javascript is superduper case sensitive.)

                  if on a .AJAX.a5w page
                  Code:
                  <%A5
                        ?"GRID1_GridObj.refresh();"
                  %>
                  Fires as a callback result the name is ok,
                  -
                  You could try splitting the javascript up
                  Leave the doTimer() function in the .A5 <head>
                  And move the initialization and first timer to the component.
                  "This is all assuming GRID1_GridObj is correct"

                  Comment


                    #10
                    Re: does anyone know of an alternative to refresh the screen

                    You could try splitting the javascript up
                    Leave the doTimer() function in the .A5 <head>
                    And move the initialization and first timer to the component.
                    Colin - I've tried a dozen permutations of this. But I don't know enough javascript to hit the right combination. Apparently no one else does either or I assume they would have pitched in here.

                    Can you be a bit more specific with a coding example? I don't really understand what you mean by "move the initialization..." What code would be used for this?

                    I know this is going to be some very simple javascript when all done, but I sure can't figure it out right now.
                    -Steve
                    sigpic

                    Comment


                      #11
                      Re: does anyone know of an alternative to refresh the screen

                      Code:
                      <script type="text/javascript">
                      var t;
                      t=setTimeout("doTimer()",1000);
                      </script>
                      This is the timer initialisation code that would need to move to the component.
                      ...
                      The problem I see is that if "GRID1_GridObj" were to be called before it actually exists in the browser, an error must occur.
                      -
                      I have seen countless websites where this occurs and with nature of javascript.

                      one protection is to use

                      Code:
                      if (GRID1_GridObj!=undefined){GRID1_GridObj.refresh();}
                      Eg check to see that GRID1_GridObj exists before using it.

                      Comment


                        #12
                        Re: does anyone know of an alternative to refresh the screen

                        This works.
                        I've modified Colin's code and I've added the Javascript directly to the grid.

                        Under Properties | Javascript - Other - Javascript Function Declarations add

                        Code:
                        // set i_delay to whatever you want, I used 15 secs.
                        var t;
                        var i_delay=15000;
                        
                        function refreshGrid(){
                        	clearTimeout(t);
                                {grid.Object}.refresh();
                        	t=setTimeout('refreshGrid()',i_delay);
                        }
                        To Javascript - System Events | onObjectInitialize add

                        Code:
                        t=setTimeout('refreshGrid()',i_delay);
                        Seems to work fine.

                        I think you could add this to multiple grids that would be displayed on a single page and it should work fine. You may have to change the names of the global Javascript variables t and i_delay or just hardcode the delay and change t, but they are scoped to the grid and as such I think they would work fine with multiple grids as is.

                        Cool and powerful concept .. I can change the data in SQL Server and see the changes every 15 secs as coded.
                        Bob Moore


                        Comment


                          #13
                          Re: does anyone know of an alternative to refresh the screen

                          Thanks Bob. One less thing I have to fiddle with tonight.

                          I think this is important, as lots of people will want this over the years, and having a definitive piece of code, and good explanation of where it goes, is important.

                          Thanks too to Colin and to Anis for pursing this.
                          -Steve
                          sigpic

                          Comment


                            #14
                            Re: does anyone know of an alternative to refresh the screen

                            So .. I think shmkinl's cheese has slipped off the bun!

                            Anyway .. After thinking about this some more I'm sure you will need to use specific timer objects for each given grid. So you may use T1, T2, T3, etc. Another unknown is the impact on a grid you are modifying. In this case you would want to disable the timer event as soon as the grid is made dirty, probably with the onRowStateChange event.
                            Bob Moore


                            Comment


                              #15
                              Re: does anyone know of an alternative to refresh the screen

                              Another unknown is the impact on a grid you are modifying. In this case you would want to disable the timer event as soon as the grid is made dirty, probably with the onRowStateChange event.
                              I believe you have a very valid point there Bob.
                              ie.. you don't want in an editable grid the user to start editing and the Grid refreshes midway,
                              Its also important to always remember that almost all javascipt is asynchronous code, which means that you can't guarantee which line is processed first, especially in matters like doing a refresh. Thus javascipt is intended to be 'event based' code. I believe also that judicious AJAX code usage can also solve most of these issues.

                              Comment

                              Working...
                              X