Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Sunil S on Nov 03, 2009 10:15
open dhtmlx forum
communication to parent window dhtmlxwindow

parent html's JS code

            function showFilterWin(){
                createPopupWindow("hierarchywin", "Change Filter", 700, 500, "jsp/hierarchypopup_cues.jsp", false, false, false, true);
            }    
            
            function test(value1, value2){
                alert (value1);
            }

--------------------------------------------------------------------------------------------------------------------------------------------------------------
window.js included in parent html

function createPopupWindow(windowId, title, width, height, url, isModal, destroyOnClose, resize, move) {
    dhxWinsInit();
    if (dhxWins.window(windowId) && dhxWins.window(windowId).isHidden()) {
        dhxWins.window(windowId).show();
        return;
    }
    var pWin = dhxWins.createWindow(windowId, 100, 100, width, height);
    dhxWins.window(windowId).centerOnScreen();
    /*pWin.attachEvent("onContentLoaded", function(win) {
        dhxWins.window(windowId).progressOff();
    });
    pWin.progressOn();*/
    pWin.setText(title);
    pWin.attachURL(url);
    //pWin.setModal(isModal);
    if (!destroyOnClose) {
        pWin.attachEvent("onClose", function() {
            dhxWins.window(windowId).hide();
            return false;
        });
    }
    if (resize) {
        pWin.allowResize();
        pWin.button("minmax1").enable();
        pWin.button("minmax1").show();
    } else {
        pWin.denyResize();
        pWin.button("minmax1").disable();
        pWin.button("minmax1").hide();
    }
    if (move) {
        pWin.allowMove();
    } else {
        pWin.denyMove();
    }
}

--------------------------------------------------------------------------------------------------------------------------------------------------------------

code in popup html.(hierarchywin html)

<script language="javascript">
    function selectNode(){

//    want to call the js function in the parent window.
//    some thing like parent.test('using', 'dhtmlxwindow v 2.3');

}

</script>

<a href="#" onclick="javascript:selectNode()"><img src="images/select.gif" alt="Select"></a>   
Answer posted by Alex (support) on Nov 04, 2009 05:10
>> want to call the js function in the parent window.  some thing like parent.test('using', 'dhtmlxwindow v 2.3');

Have you tried to use this approach? parent.selectNode() is correct way to call functions from the parent window:  jsp/hierarchypopup_cues.jsp is loaded into iframe by attachURL method.