Announcement

Collapse
No announcement yet.

How to Get a Grid to Refresh Programmatically

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

  • How to Get a Grid to Refresh Programmatically

    I have a grid application with some action buttons. One of these, when pressed, will perform bulk changes in the database tables that the grid is based on. Thus, after the code that changes the database has executed, I would like for the grid to be refreshed and any dynamic and/or advanced search criteria to be cleared. I have looked at the SC macros to find one that would do this for me with no luck.

    Is there a suitable macro, or is there another way to do it with PHP code (i.e. in the PHP Code section of the action button)?
    Best regards,

    Frank

  • #2
    Did you tried sc_ajax_refresh();?
    /Giuseppe

    Professional Scriptcase Services
    Some Customers opinions

    Comment


    • #3
      Good suggestion. Unfortunately, it cannot be used in the PHP code for a button. It gives the following error:
      "Fatal error: Call to undefined function sc_ajax_refresh() in .... {application name} line ..."

      So I need to be able to make the grid refresh and clear any dynamic and/or advanced search criteria from the PHP code of a button.
      Best regards,

      Frank

      Comment


      • #4
        I found the SC macro: sc_exit(sel) or sc_exit(ref).
        It will restart the application directly and thereby refresh the grid. It will, however, not remove any criteria on the grid, which is fine.
        If the grid is to be totally reset, on can use sc_redir and point to the same application.
        Best regards,

        Frank

        Comment


        • #5
          agreed with orion tho another way of doing this is with an sc_redir, that will force the application to refresh

          regards

          Comment


          • #6
            Originally posted by kafecadm View Post
            agreed with orion tho another way of doing this is with an sc_redir, that will force the application to refresh

            regards
            Yes, I agree, but I did not suggested this because sc_redir don't clear criterias, and about sc_ajax_refresh() wasn't sure because I didn't tried.
            /Giuseppe

            Professional Scriptcase Services
            Some Customers opinions

            Comment


            • #7
              hey Giu:

              How about using an sc_redir with an sc_reset_apl_conf... would dat work?.

              Regards

              Comment


              • #8
                I don't think so, but it's worth a try.

                If not, maybe, playing with WHERE macros, and manipulating manually "SC_Gb_Free_cmp" session value for groupby, could do the trick.

                I'm sure is more easy than we offer, but right now my brain is collapsed
                /Giuseppe

                Professional Scriptcase Services
                Some Customers opinions

                Comment


                • #9
                  This may help, see http://solidlystated.com/scripting/php-refresh-page/

                  Comment


                  • #10
                    Originally posted by Orion View Post
                    I would like for the grid to be refreshed and any dynamic and/or advanced search criteria to be cleared.
                    Automatic refresh a grid: Grid / Settings / Refresh Interval in seconds

                    Clear search criteria in forms (!):

                    Code:
                    $_SESSION['sc_session'][$this->Ini->sc_page]['<your_form>']['where_filter']   = "";
                    $_SESSION['sc_session'][$this->Ini->sc_page]['<your_form>']['fast_search'][0] = "";
                    $_SESSION['sc_session'][$this->Ini->sc_page]['<your_form>']['fast_search'][1] = "";
                    $_SESSION['sc_session'][$this->Ini->sc_page]['<your_form>']['fast_search'][2] = "";
                    (in onLoad-Event)

                    I'am not sure that works with grids, but try it ...



                    Best regards: - Reinhard -

                    I use ScriptCase 8 Enterprise Edition, Version 8.(latest)

                    Comment


                    • #11
                      Thanks for the suggestions Larry and RHS!

                      I think that the refresh method (http://solidlystated.com/scripting/php-refresh-page/) will work something like the sc_exit macro. I will have a look next time.

                      The Grid / Settings / Refresh Interval in seconds is very interesting. I have some parts of an application where I plan for the user to get updates on how a background process is doing (i.e. it logs in the database as work is done). A automatic refreshing grid will be just the thing.
                      Best regards,

                      Frank

                      Comment


                      • #12
                        Can you just use sc_redir ?


                        www.LiviApps.com (Scriptcase Specialist - English language)
                        www.OwenSolution.com (Scriptcase Specialist - Indonesian language)

                        Comment


                        • #13
                          How about this: https://en.wikipedia.org/wiki/Meta_refresh

                          Comment

                          Working...
                          X