Announcement

Collapse
No announcement yet.

Master Detail Form Refresh / Reload

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

  • Master Detail Form Refresh / Reload

    Hi Friends,

    I need help on form refresh / reload.

    Here, I have

    1) a master FORM "A" displaying one record
    2) a detailed GRID "B" displaying records based on master for.
    3) an EDITABLE GRID VIEW "C" taking new records.

    Once data is entered in to EDITABLE GRID VIEW, I have a "PROCESS" Button to do multiple task including (A) updating a record in MASTER FORM "A", (B) updating records in DETAILED GRID "B", and (C) displaying new records in EDITABLE GRID VIEW "C"

    The problem is the data are saved but the ALL FORMS "A", "B", "C" are NOT reloading new data. I tried the following :

    A) Creating new Javascript method Called "ReloadData", which contains

    //Code also from this forum
    var elem = document.getElementById('nmsc_iframe_liga_grid_tmp _bill_details'); //grab the detail form
    elem.src = elem.src; //cause the form to reload
    elem = document.getElementById('nmsc_iframe_liga_form_tmp _payment'); //grab the detail form
    elem.src = elem.src; //cause the form to reload

    B) Within "PROCESS" Button PHP Code, I have a macro "sc_ajax_javascript ('ReloadData')". Still does NOT reload new data.
    It seems to me that javascript "ReloadData" is never called but I don't know why. Is it because it is not "ON EVENTS"?

    Any help / suggestions are much appreciated.

    Capecode

  • #2
    I'm not a javascript guru, so can't answer that part. What might work is to do a sc_redir to parent to fully reload your page which will then have the correct data. But the form is refreshed which looks less cool then refreshing using ajax. But at least it's how I solve issues like this.
    Albert Drent
    aducom software netherlands
    scriptcase partner, reseller, support and (turn-key) development
    www.scriptcase.eu / www.scriptcase.nl

    Comment


    • #3
      Thanks for your suggestion.

      Unfortunately, I tried that and it does not work the way I wanted it because I have "PROCESS" button in EDITABLE GRID VIEW "C". So when I use sc_redir, it reload the whole form in iframe "C".

      Comment


      • #4
        It might be that you need to sc_redir to a certain iframe which you can lookup in your htmlcode. Don't know it's name you can find out by using firebug or something similar. Then it will reload within the correct iframe.
        Albert Drent
        aducom software netherlands
        scriptcase partner, reseller, support and (turn-key) development
        www.scriptcase.eu / www.scriptcase.nl

        Comment


        • #5
          Hi,
          you might take a little detour. Try this:

          1. Create a php-method i.e. refresh_iframe_p() and call your 'ReloadData' from there.
          2. Call your php-method from your button;

          Hope this helps.

          jsb

          Comment


          • #6
            Thanks jsbinca,

            It is working now.

            Comment


            • #7
              Hi Capecode, jsbinca and others,

              Could you please explain how you manage to reload master form using the approach provided by jsbinca?

              Master form : frmMaster (single record)
              Detail form : frmDetail (editable grid view)

              In frmDetail 'onAfterUpdate' event it call a php method namely
              RefreshParentForm();

              The code for php method in frmDetail:
              function RefreshParentForm
              sc_ajax_javascript ('ReloadData');

              The code for JavaScript Method in frmDetail:
              function ReloadData

              var elem = document.getElementById('frmMaster');
              elem.src = elem.src;

              Note : I don't know how to get the Id for getElementById();

              Thank you.

              Comment


              • #8
                hello:

                Have you tried a sc_redir in the afterinsert event?

                if something is modified in B use an

                PHP Code:
                sc_redirForm_Aidform_A=<CurrentID>,"_parent"); 
                This will call all 3 forms with the updated data.

                Regards

                Comment


                • #9
                  Hi kafecadm,

                  Thanks for your help.

                  The redir method did worked however it will caused the form refresh which is less cool.
                  I prefer using ajax refresh because it will not caused screen flickering.
                  Can anyone help me in using the method provided by jsbinca.

                  Comment

                  Working...
                  X