Passing jQgrid rowid from an iFrame to the dialog box of the main .html

i need some help here. I have a dialog box that contains an iFrame with my html file of a jqgrid. What i want to do is that when I double click a data from the jqrid inside that dialog box, the dialog box will automatically close and will post the id of the row that was click in the first dialog box.

Here's my javascript code:

EDIT:(Note: this code is from subAccount.js)

$( "#mainGrid" ).click(function() { //note: mainGrid is inside of another dialog box where i should post the row id
   $( "#dialogMainAccount" ).dialog( "open" );  //this is the dialog box that contains my .html with jqgrid in it.
   $( "#dialogMainAccount" ).append(
      '<p>Please choose code to add in Sub Account Group.</p>'+
      '<iframe src="mainAccountGroup.html" width="100%" height="800">' +  // i use an iFrame to open my .html file
        '<p>Your browser does not support iframes.</p>' +
      '</iframe>');     
});

Edit: This is my code for closing the dialog box inside the mainAccountGroup.js

$("#tblData1").jqGrid({
    .//some code here
    .
    .
    caption: "Main Account Group",
    ondblClickRow: function(rowid) {
       parent.$("#dialogMainAccount" ).dialog("close");
    ....
}); 

I already include the mainAccountGroup.js inside my subAccount.html. NOTE, first question solve in how to close the dialog box after double clicking a row in jqgrid.

Another question is, how to pass the rowid that was click from that jqgrid in the iFrame, to the text box of the first dialog box? Passing values from a .html in a iframe to a dialog box in the main html.

Answers


If I understand you correct you can just call $("#dialogMainAccount").dialog("close") or $("#dialogMainAccount").dialog("destroy") inside of your ondblClickRow event handler of the jqGrid to close the dialog.

UPDATE: if you from the code running in the iframe want access variable myVar define as global (on the top level) you should use inside of iframe the parent.document prefix: parent.document.myVar.

If you need access HTML elements defined in the main frain from the iframe you should use parent.document as the context parameter of the jQuery. For example $('#mainAccount',parent.document).


Need Your Help

Invalid Argument exception when using setText on UILabel

iphone string exception progress-bar uilabel

Im going crazy trying to debug a problem, where I get an exception

How to use jQuery selector/find() against text string without inserting into the DOM?

javascript jquery jquery-selectors documentfragment

I have a text string i'm trying to select the spans from using jQuery. I'd like to grab the spans w/o adding the element to the dom -- if that's possible?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.