Categories | Question details Back To List | ||
cannot call parent javascript Hi, I am using the following code to render a window with some attached objects: ---------------------------------------- index.html: ---------------------------------------- // open window ajaxExt_NumNCallsWindow = dhxWins.createWindow('ajaxExt_NumNCallsWindow', 0, 0, 922, 640); ajaxExt_NumNCallsWindow.centerOnScreen(); ajaxExt_NumNCallsWindow.setText('Network Call Stats'); ajaxExt_NumNCallsWindow.button('park').disable(); ajaxExt_NumNCallsWindow.button('park').hide(); // attach layout ajaxExt_NumNCallsLayout = ajaxExt_NumNCallsWindow.attachLayout('2E', 'dhx_blue'); // cell a ajaxExt_NumNCallsLayout.cells('a').hideHeader(); ajaxExt_NumNCallsLayout.cells('a').setHeight(55); ajaxExt_NumNCallsLayout.cells('a').attachURL('cell_a.html'); // cell b ajaxExt_NumNCallsLayout.cells('b').hideHeader(); // attach tabbar ajaxExt_NumNCallsTabbar = ajaxExt_NumNCallsLayout.cells('b').attachTabbar(); ajaxExt_NumNCallsTabbar.setImagePath('/3rdparty/dhtmlx/imgs/'); ajaxExt_NumNCallsTabbar.setHrefMode("iframes") // tab b1 ajaxExt_NumNCallsTabbar.addTab('b1', 'Network Stats', '100px'); ajaxExt_NumNCallsTabbar.setContentHref('b1', 'cell_b1.html'); ajaxExt_NumNCallsTabbar.setTabActive('b1'); // tab b2 ajaxExt_NumNCallsTabbar.addTab('b2', 'Detailed Stats', '100px'); // attach grid ajaxExt_NumNCallsGrid = ajaxExt_NumNCallsTabbar.cells("b2").attachGrid(); ajaxExt_NumNCallsGrid.setImagePath('/3rdparty/dhtmlx/imgs/'); ajaxExt_NumNCallsGrid.setHeader('Date,Number,Calls,Minutes,Revenue'); ajaxExt_NumNCallsGrid.setInitWidths('80,80,50,70,70'); ajaxExt_NumNCallsGrid.setColAlign('left,left,right,right,right'); ajaxExt_NumNCallsGrid.setColTypes('ro,ro,ro,ro,ro'); ajaxExt_NumNCallsGrid.setColSorting('str,str,str,str,str'); ajaxExt_NumNCallsGrid.setColumnsVisibility('false,false,false,false,false'); ajaxExt_NumNCallsGrid.enableMultiselect(false); ajaxExt_NumNCallsGrid.setSkin('light'); ajaxExt_NumNCallsGrid.preventIECaching(true); ajaxExt_NumNCallsGrid.init(); ajaxExt_NumNCallsGrid.loadXML('cell_b2.xml'); function my_function() { alert('Success'); } ---------------------------------------- ---------------------------------------- cell_a.html ---------------------------------------- <input value="foo" onClick="my_function()" /> ---------------------------------------- I am unable to call my_function() from within cell_a.html, it says undefined or not a function depending on how it is called (I have tried calling with parent. and parent.parent and parent.parent.parent prepended to it. How can I call my_function() please? Answer posted by Support on Jun 05, 2009 07:31 The correct code will be <input value="foo" onClick="parent.my_function()" /> Please be sure that - there is no any other objects on the page, which named as my_function - the function defined on global level ( if it was defined inside other function - it will not be accessible for outer scripts ) Answer posted by Martin Allchin on Jun 05, 2009 07:52 Thanks for the quick response. I had a bug in my code, sorry to trouble you with this. Thanks again! |