Alpha Video Training
Results 1 to 4 of 4

Thread: Button on one grid to refresh another grid

  1. #1
    VAR Pat Bremkamp's Avatar
    Real Name
    Pat Bremkamp
    Join Date
    Apr 2000
    Location
    Oregon, USA
    Posts
    2,645

    Default Button on one grid to refresh another grid

    Sorry to ask this yet again...I know it has been discussed a lot, but I've searched for several hours and can't find it. Maybe one of you can point me to it or just tell me the answer.

    I have two independent grids in a page in a tabbed UI. One grid, "job_selected", just shows one row of data indicating the selected job. The second grid, "job_select" is a list of jobs and has a "select" button on each row to pick a job and make it the selected job. So, the user comes to the page, searches in job_select for the job and clicks the button. I do an ajax callback to set a session variable and then use that session variable to filter job_selected and all the rest of the grids and pages. That works, but I can't get the job_selected grid to refresh. If I refresh the page manually, I can see the selected job, but I just want to refresh the grid from the button.

    So, in grid "job_select" is a button that runs the Xbasic callback function "selectJob" that sets
    e.session.__protected__jobid = e.currentRowKeys[1]

    Then, I think, in the callback, I want to set a flag in a JavaScript variable that says the callback has been run, so I tried
    selectJob = "sjCallbackFlag = true;"
    and
    selectJob = "var sjCallbackFlag = true;"

    Then in the afterAjaxCallbackComplete system event, I want to check the flag, do the refresh and set the flag to false. Here my JavaScript fails me... I entered

    if (svRunFlag == true) {
    JOB_SELECTED_GridObj.refresh();
    svRunFlag = false;
    }

    I don't get any errors, but nothing happens. I'd appreciate some help.
    Pat
    Pat Bremkamp
    MindKicks Consulting

  2. #2
    Member
    Real Name
    Roger Noguera
    Join Date
    Jul 2010
    Location
    Sant Cugat del Vallès
    Posts
    236

    Default Re: Button on one grid to refresh another grid

    I had a similar problem.
    In the afterAjaxCallbackComplete, instead of using the flags use the e.ajaxEvent object.
    This object lets you check the exact Ajax procedure that made the callback:

    if (e.ajaxEvent=='saveGridData')
    {
    {grid.Object}.refresh();
    }

    I hope this helps you.
    If you can, use window vars instead of session vars, development is much faster as they also work in the "Working Preview":

    This writes a window variable:

    window['win_id_hoja']=id_hoja;

    And this reads the variable:

    id_hoja=window['win_id_hoja'];

    They are available to all grids on the same page.

    I use this code to update the parent grid from the child grid (it is not a TabbedUI like you have):


    //Get parent grid...
    var po = {grid.object}.getParentObject();

    //If this Grid does not have a parent then 'po' will be false.
    //Refresh parent grid...
    if(po) po.refreshLinkedContent();

    Probably this doesn't work in a TabbedUI.

    Finally you can always use Linked Grids instead of TabbedUI. If they don't have a single filed you can use to link them, you can always create a dummy field...

  3. #3
    VAR Pat Bremkamp's Avatar
    Real Name
    Pat Bremkamp
    Join Date
    Apr 2000
    Location
    Oregon, USA
    Posts
    2,645

    Default Re: Button on one grid to refresh another grid

    This sounds like what I need, but I couldn't get it to work.

    Is e.ajaxEvent the name of the Xbasic function?

    Pat
    Pat Bremkamp
    MindKicks Consulting

  4. #4
    Member
    Real Name
    Roger Noguera
    Join Date
    Jul 2010
    Location
    Sant Cugat del Vallès
    Posts
    236

    Default Re: Button on one grid to refresh another grid

    This is javascript.

    In the event afterAjaxCallbackComplete type:

    Code:
    alert(e.ajaxEvent);
    And you will get a message each time a callback is finished, with the name of the callback.

Similar Threads

  1. Refresh Grid component
    By David Boomer in forum Application Server Version 10 - Web/Browser Applications
    Replies: 5
    Last Post: 11-28-2010, 03:50 PM
  2. button on grid to refresh a field
    By David Boomer in forum Application Server Version 10 - Web/Browser Applications
    Replies: 0
    Last Post: 09-20-2010, 02:55 PM
  3. Only grid refresh not the whole page
    By Atta in forum Application Server Version 10 - Web/Browser Applications
    Replies: 5
    Last Post: 03-29-2010, 03:41 PM
  4. Updating the main grid with info from the child grid in a tabed grid linker
    By Mwhite in forum Application Server Version 9 - Web/Browser Applications
    Replies: 5
    Last Post: 06-30-2009, 06:40 PM
  5. Auto-refresh grid
    By Steve Workings in forum Application Server Version 8
    Replies: 5
    Last Post: 08-24-2007, 11:22 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •