Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 02-07-2013, 12:43 PM   PM User | #1
BobbyRachel
New Coder

 
Join Date: Dec 2012
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
BobbyRachel is an unknown quantity at this point
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>
BobbyRachel is offline   Reply With Quote
Old 02-07-2013, 02:05 PM   PM User | #2
niralsoni
Regular Coder

 
Join Date: Mar 2008
Location: London
Posts: 143
Thanks: 3
Thanked 38 Times in 38 Posts
niralsoni is an unknown quantity at this point
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;
}
niralsoni is offline   Reply With Quote
Reply

Bookmarks

Tags
javascript

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:44 AM.


Advertisement
Log in to turn off these ads.