Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Larry Hamlet on Apr 16, 2009 10:53
open dhtmlx forum
Need A Return From dhtmlxGrid Using A dhtmlxLayout Panel

I want to use dhtmlxGrid in a dhtmlxLayout Panel.

I successfully use Php to create HTML complete with Grid loading using XML. This works fine stand-alone. I can click on a button and return anything from the Grid I choose.

Now I try to attach this same Grid using
dhxLayout.cells('d').attachURL('../Folder/PhpFile.php?x='+blah);
The Grid appears and operates the same as stand-alone.
But I cannot get any return to the calling js underlying the dhtmlxLayout.

So I have also tried attaching a DIV to the Panel using
document.body.appendChild(divTag);
This one will report back to the calling js underlying the dhtmlxLayout.
But in this case the Grid doesn't load althought the full HTML is written in the new DIV.

So I seem stuck between these two worlds. How do I attach the Php/XML-built Grid to the Panel and still have the data return to the calling JS for further processing?
Answer posted by Alex on Apr 17, 2009 01:46

Hello,

The same issue was already discussed on our forum. Please, take a look:

http://dhtmlx.com/docs/products/kb/index.php?s=normal&q=9031

Answer posted by Larry Hamlet on Apr 17, 2009 08:03

OK.  Very interesting.  I can use this elsewhere.  Thanks!  But quite different from what I am asking.

Let me rephrase the entire question.  This time using one of your sample Grids. -- dhtmlxGrid/samples/initialization_loading/grid_xml_formats.html

I add the following single line of code just beneath your own <div id="gridbox" ...
  <input onclick="powerfulMessage=mygrid.cells(11,1).getValue();receiveGodLikeMessageFromLayoutA(powerfulMessage);" type="button" value="Send The miracleClass Your Powerful Message!">

In my miracleClass.js I deploy the following url load: -- dhxLayout.cells('a').attachURL('dhtmlxGrid/samples/initialization_loading/grid_xml_formats.html'); with my added Button.

Also inside my miracleClass.js I have -- function receiveGodLikeMessageFromLayoutA(powerfulMessage) { alert('Your Powerful Message Was: '+powerfulMessage); }

Clicking the Button should return "Alice in Wonderland" to my miracleClass.js.  But instead I throw an error because it can't find the function receiveGodLikeMessageFromLayoutA() in my miracleClass.js.

How do I accomplish this simple task?

Larry


Answer posted by Alex (support) on Apr 20, 2009 03:22

As the page dhtmlxGrid/samples/initialization_loading/grid_xml_formats.html is inside iframe.  receiveGodLikeMessageFromLayoutA function must be called from iframe:

parent.receiveGodLikeMessageFromLayoutA(powerfulMessage);

Answer posted by Larry Hamlet on Apr 20, 2009 08:42

Now that worked just fine!  Simple "duhs" for simple minds...  Thanks so much!  --  Larry