returning a datatable created in a popup to the parent window
returning a datatable created in a popup to the parent window
I am creating a datatable in a popup window and I need to return it to the parent window. Everything works fine. However, when I click few input checkbox and use the serializer, it's returning empty value.
Here's my code that I use to return datatable to the parent window
[code]
var parent = $(window.opener.document.body);
var csvdata = $(parent).find('#csvdata');
var thistable = $("#mytable");
$(csvdata).html(thistable);
var parent_table = $(parent).find('#mytable');
var contactsTable = $(parent_table).dataTable({
"bProcessing": true,
"bJQueryUI": true,
"bSortClasses": false,
"sEmptyTable": "No contacts!",
"sScrollY": "120px",
"bPaginate": false
});
contactsTable.fnAdjustColumnSizing();
window.opener.contactsTable = contactsTable; //This is how i'm passing the table from popup to parent
$(csvdata).show();
window.close();
[/code]
Once it's passed to the parent window, here's my code that I use in the parent window
[code]
contactsTable = $("#mytable").dataTable();
sData = $('input', contactsTable.fnGetNodes()).serialize();
alert("data = " + sData);
[/code]
data is empty for some reason. It should return the serialize value of the contacts selected in my table which was passed from the popup to the parent.
Strange thing is that when I test this code in Firebug console, it seems to run fine and actually returns the serialize value. Can you help?
Here's my code that I use to return datatable to the parent window
[code]
var parent = $(window.opener.document.body);
var csvdata = $(parent).find('#csvdata');
var thistable = $("#mytable");
$(csvdata).html(thistable);
var parent_table = $(parent).find('#mytable');
var contactsTable = $(parent_table).dataTable({
"bProcessing": true,
"bJQueryUI": true,
"bSortClasses": false,
"sEmptyTable": "No contacts!",
"sScrollY": "120px",
"bPaginate": false
});
contactsTable.fnAdjustColumnSizing();
window.opener.contactsTable = contactsTable; //This is how i'm passing the table from popup to parent
$(csvdata).show();
window.close();
[/code]
Once it's passed to the parent window, here's my code that I use in the parent window
[code]
contactsTable = $("#mytable").dataTable();
sData = $('input', contactsTable.fnGetNodes()).serialize();
alert("data = " + sData);
[/code]
data is empty for some reason. It should return the serialize value of the contacts selected in my table which was passed from the popup to the parent.
Strange thing is that when I test this code in Firebug console, it seems to run fine and actually returns the serialize value. Can you help?
This discussion has been closed.