How do i refresh a datagrid from a popup window without re opening the page...

P

pkenty

Hi, does any one know how to refresh a datagrid on one page from another page without having to load the whole page again

Let me explain

Ive got a page with 4 tabs on it with different datagrids in each tab..I have a add button on one page that open a new pop up window which allows the user to add a new resource to the datagrid...Once the user has selected a resource to add to the datagrid , i want the page to send an event to the Main datagrid page to refresh the data grid to show the new added record... I dont want to have to use window.opener to re open the whole window because the whole page refreshing is too slow..

Any ideas
Thank
Paul
 
K

Kilic Beg

Hi,

your question peeked my interest...
I spend couple hour to figure it out but I guess I fond the solution...
below is the HTML code and Javascript:
====================================
<html>
<head>
<script language="javascript">
function addRow(strCol1, strCol2, strCol3, strCol4, strCol5, strCol6)
{
var MainTbl = document.getElementById("tblTestID");
var rowcopy = MainTbl.rows[MainTbl.rows.length-1].cloneNode(true);
MainTbl.rows[MainTbl.rows.length-1].cells[0].innerHTML = strCol1;
MainTbl.rows[MainTbl.rows.length-1].cells[1].innerHTML = strCol2;
MainTbl.rows[MainTbl.rows.length-1].cells[2].innerHTML = strCol3;
MainTbl.rows[MainTbl.rows.length-1].cells[3].innerHTML = strCol4;
MainTbl.rows[MainTbl.rows.length-1].cells[4].innerHTML = strCol5;
MainTbl.rows[MainTbl.rows.length-1].cells[5].innerHTML = strCol6;
MainTbl.rows[MainTbl.rows.length-2].appendChild(rowcopy);
}
</script>
</head>
<body>
<DIV id="DivMain">
<table id="tblTestID" width="600" cellspacing="0" cellpadding="0"
border="1">
<tr>
<td>Row 1 Col 1</td>
<td>Row 1 Col 2</td>
<td>Row 1 Col 3</td>
<td>Row 1 Col 4</td>
<td>Row 1 Col 5</td>
<td>Row 1 Col 6</td>
</tr>
<tr>
<td>Row 2 Col 1</td>
<td>Row 2 Col 2</td>
<td>Row 2 Col 3</td>
<td>Row 2 Col 4</td>
<td>Row 2 Col 5</td>
<td>Row 2 Col 6</td>
</tr>
<tr>
<td>Row 3 Col 1</td>
<td>Row 3 Col 2</td>
<td>Row 3 Col 3</td>
<td>Row 3 Col 4</td>
<td>Row 3 Col 5</td>
<td>Row 3 Col 6</td>
</tr>
</table>
</DIV>
<BR>
<BR>
<a href="javascript:addRow('Row 4 Coll 1','Row 4 Coll 2','Row 4 Coll
3','Row 4 Coll 4','Row 4 Coll 5','Row 4 Coll 6');">addRow</a>
</body>
</html>
=====================================
just call addRow function from your popUp window before your close it and
pass the valuues for it..

----------------
Kilic Beg

pkenty said:
Hi, does any one know how to refresh a datagrid on one page from another
page without having to load the whole page again?
Let me explain.

Ive got a page with 4 tabs on it with different datagrids in each tab..I
have a add button on one page that open a new pop up window which allows the
user to add a new resource to the datagrid...Once the user has selected a
resource to add to the datagrid , i want the page to send an event to the
Main datagrid page to refresh the data grid to show the new added record...
I dont want to have to use window.opener to re open the whole window because
the whole page refreshing is too slow...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,008
Latest member
HaroldDark

Latest Threads

Top