Categories | Question details Back To List | ||||||||||||||||||||
Tree on one site - grid on the other - how to update Thanks for your help as I'm working through this learning curve. I want to have a tree on the left side and when node of the tree is clicked I want a different grid to show up on the right. I know I need to use event handlers but I don't know how to relate the two panes. I also don't know if, for the grid, I have to create separate HTML pages (with the grid inside) and call each one, or I can just call the grid itself and it shows up in the pane. Speaking of pane, I know I'm being a pain :) Thanks again! Answer posted by Support on Dec 11, 2008 04:49 >>or I can just call the grid itself and it shows up in the pane. You can use the same grid object and just reload data in it Technically you need to create a grid and tree on the page ( as separate object or through layout ) and attach the event to the tree as tree.attachEvent("onClick",function(id){ grid.clearAll(); grid.loadXML("some.php?for="+id); return true; }); with such logic, each time when item in tree selected - grid will clear existing data and load new dataset from specified url . Answer posted by gb on Dec 11, 2008 07:35 So I need this javascript for each node on the tree (with a diffrent id)? Is there anything I need to include in the (xml) code of the tree itself? Answer posted by Support on Dec 11, 2008 08:18 >>So I need this javascript for each node on the tree (with a diffrent id)? You need to define such script once for all tree. > Is there anything I need to include in the (xml) code of the tree itself? You need not any etra markup in XML, just em@id attribute to link item in tree with related grid data. Answer posted by GB on Dec 11, 2008 11:46 Sorry to bother you again. What do mean by em@id ? Here is my code; still can't get it to work: var dhxTree = dhxLayout.cells("a").attachTree(0); The script that pulls up the XML is working by itself. Thanks again.
Answer posted by GB on Dec 11, 2008 21:42 OK, I got the javascript to work, thanks to your help. Now the browser is complaining about my xml. I am getting a javascript error but if I insert another xml file it seems to work, but it looks EXACTLY the same. I have attached the XML file here. I think I'm almost there; I really like your program.
Attachments (1)
Answer posted by Support on Dec 12, 2008 03:00 Provided xml file works correctly. The issue may be caused by the scrpit which must generate xml output in your case ("ajax_xml.fwx") Please be sure that script generates data with correct content type - text/xml Also you can try to use debug version of dhtmlxcommon.js to check the possible reason of problem. http://dhtmlx.com/docs/products/kb/index.shtml?cat=search&q=2545&ssr=yes&s=dhtmlxcommon Attachments (1)
Answer posted by GB on Dec 12, 2008 06:12 Thanks. I actually found that other .js last night - it helped me get the javascript working. The problem is not the script; the error comes up right away on the initial loading of the (static) xml page. I have attached the html file, the xml, and the error code. It says the error is on "line 119" and there aren't that many lines on my page.
Attachments (1)
Answer posted by Support on Dec 12, 2008 07:59 >>dhxGrid.loadXML("http://secure.spidermed.com/ajax_xml.fwx?for="+id); The problem may be in cross-domain request. Browser deny any request to domain different from the one, from which main page loaded. So, to work correctly, both the page and data feed must be loaded from the same domain ( or you need to use some kind of server side proxy grid.loadXML("proxy.do") and proxy.do request data from http://secure.spidermed.com/ajax_xml.fwx ) Answer posted by GB on Dec 12, 2008 10:14 I thought of that, but even if you take that code (the event handler) completely out of the page, I still get the error. I am testing the page locally on the hard drive and the static xml pages are right there in the same directory. Besides the javascript error your .js test code says "Error XML:false", which makes me think there is something wrong with the xml files. Answer posted by GB on Dec 12, 2008 10:14 I thought of that, but even if you take that code (the event handler) completely out of the page, I still get the error. I am testing the page locally on the hard drive and the static xml pages are right there in the same directory. Besides the javascript error your .js test code says "Error XML:false", which makes me think there is something wrong with the xml files. Answer posted by GB on Dec 12, 2008 23:52 I got it working. Thanks for all your help.
|