Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Dec 2012
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Accessing parent window from child window?

    I have a main window named worklistManager.jsp.
    worklistManager.jsp has a pop up window named processManager.jsp.
    Again, processManager.jsp has another pop up window, named eventLog.jsp.
    Once again eventLog.jsp has a pop up window named eventUsers.jsp.

    eventUsers.jsp has a dojox/grid/DataGrid and a button. After selecting a particular row in the grid, then clicking the button, it has to place the value into the textbox of eventLog.jsp after closing eventUsers.jsp.

    So far, I have tried the script below to accomplish this, but it's not working as I hoped.

    Code:
    <script type="text/javascript">
    function getEventLogUserSelect(){
        if(dijit.byId('dynamiceventusergridCWUSER')){
            var selctedItem = dijit.byId('dynamiceventusergridCWUSER').selection.getSelected();
            if(selctedItem.length){
                dojo.forEach(selctedItem, function(selectedItem){
                    if(selectedItem !== null){
                        dojo.forEach(dijit.byId('dynamiceventusergridCWUSER').store.getAttributes(selectedItem), function(attribute){
                            var value = dijit.byId('dynamiceventusergridCWUSER').store.getValues(selectedItem, attribute);
                            if(attribute == "USERID"){
                                window.opener.SetValue(value);
                                window.close();
                            }
    
                        });
                    }
                });
                //alert("grid row selected");
            }else{
                alert("grid row not selected");
            }
        }
        if(gbshowgridFlag==false){
            alert("grid not loaded");
        }
    }
    function SetValue(val){
           var txt = document.getElementById('CWPROCESSEVENTLOG.USER_ID');
           txt.value = val;
    
        }
    </script>

  • #2
    Regular Coder
    Join Date
    Mar 2008
    Location
    London
    Posts
    152
    Thanks
    4
    Thanked 42 Times in 42 Posts
    As you are calling window.opener.setvalue(value) function, setValue function must be in eventLog.jsp page rather then eventUsers.jsp

    Alternatively, you must change your code to -
    Code:
    .....
    window.setValue(value);
    window.close();
    .....
    
    function SetValue(val){
      var txt = window.opener.document.getElementById('CWPROCESSEVENTLOG.USER_ID');
      txt.value = val;
    }


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •