Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Stephen Neander on May 18, 2009 13:41
open dhtmlx forum
How to refesh a grid in a layout/tab from another window

Yes there were 4 other similar tabs. Removed this code to try and make it clearer. They all need to work the same way.

I tried passing gridNotes through the AddNote method. Not sure why I need to do this as gridNotes is defined outside of the function anyway as shown.

showSuccess.php
============
var gridNotes;
function doAddNote(gridPassed){  
...
}
function doInitToolbars(){
...
  // toolbarNotes is the toolbar for the grid and contains a button to add a new record.
  toolbarNotes.attachEvent("onClick", function(id){
      if (id == "button_notes_add")
        doAddNote(gridNotes);
  }
}


editSuccess.php (The URL that is attached to the created window)
===========
...
// dhxToolbar is the toolbar in the pop up window and contyains a button to save the record.
dhxToolbar = window_self.attachToolbar();
dhxToolbar._related_grid = gridPassed;
alert(gridPassed); // Shows that gridPassed is undefined.


How do I get the grid variable from the AddNote function and make it available in the window containing the attached URL?
Answer posted by Alex (support) on May 18, 2009 23:26
attachURL loads content into an iframe. The iframe is available by _frame property:

var frame = win._frame;

So, grid object is

var grid= frame.contentWindow.gridObject;

In case of calling parent methods from apage inside an iframe: parent.someFunction();