Solved

How to reload Frames with new data?

Posted on 2001-06-04
11
313 Views
Last Modified: 2010-04-09
Dear friends,

I have a frame. Inside the frame i am displaying a Table with datas. "onclick" of the Table header i am calling a JavaScript (onclick="JavaScipt:sort(param)) which sorts the table and writes back to the frame again.

When i write, the new table gets created below the old table and both the tables are there. I want to erase the old table from the frame and i want to write the new table in the frame. Is it possible.

Its done in Jsp, so if i reload the page it makes a server trip, which should not happen for sorting.

Can anybody help.

Best Regards,
Prasanna.
0
Comment
Question by:Prasanna23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6152907
Can you post that part of the code that rewrites the table, and the HTML for
the frame with the table?

Cd&
0
 
LVL 8

Expert Comment

by:bebonham
ID: 6153019
the only way to do it is to write all you variables into another frame in the frameset. (in javascript)

that frame can write and rewrite as much as it likes

but it will all have to be handled in javascript

do you need more information or a sample?

Bob
0
 
LVL 5

Expert Comment

by:pstavrinides
ID: 6153272
create multiple div tags over one another, and set the position to absolute... use the visability property to hide/show your specific table when you want to.
0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 
LVL 8

Expert Comment

by:bebonham
ID: 6154447
yeah, but you cannot make a div tag and table of every possibility.

that would not be a dynamic solution.

if all the data is written into a javascript array, then the controling frame can change the table to any possibility without the use of divs.

Bob
0
 

Author Comment

by:Prasanna23
ID: 6154909
Dear Bob,

I am already using javascript array to store all my table data. I have already tried with div tag, it keeps generating the code every time i show and hide. So is there any other way rewrite the frame.

Can u please give me the sample code or more information regarding how to do it.

Thanks and Best Regards,
Prasanna
0
 

Author Comment

by:Prasanna23
ID: 6155213
Hai,

Here with i have given the code which i used. can anybody help.

Best Regards,
Prasanna
***********************************************************
function sort(param)
{
     alert("sort");
     myObjectBubbleSort(myObjectArray,objectArrayIndex,param);
     output="";
     showObjectArray(myObjectArray,objectArrayIndex);
}

function myObjectBubbleSort(arrayName,length,property) {
                         
     for (var i=0; i<(length-1); i++)
         for (var j=i+1; j<length; j++)
             if (eval('arrayName[j].' + property + '<arrayName[i].' + property))
          {
                 var dummy = arrayName[i];
                 arrayName[i] = arrayName[j];
                 arrayName[j] = dummy;
                 }
     alert('bubble');
}


function showObjectArray(object, length)
{    
    var l1= 0;
                         
    output += '<table bgcolor="FFDDB0" border="2"><tr><th><span onclick="JavaScript:sort(\'name1\')" style="color:blue; cursor:hand;">name1</span></th><th><span onclick="JavaScript:sort(\'name2\')" style="color:blue; cursor:hand;">name2</span></th><th><span onclick="JavaScript:sort(\'name3\')" style="color:blue; cursor:hand;">name3</span></th><th><span onclick="JavaScript:sort(\'name4\')" style="color:blue; cursor:hand;">name4</span></th><th><span onclick="JavaScript:sort(\'name5\')" style="color:blue; cursor:hand;">name5</span></th><th><span onclick="JavaScript:sort(\'name6\')" style="color:blue; cursor:hand;">name6</span></th><th><span onclick="JavaScript:sort(\'name7\')" style="color:blue; cursor:hand;">name7</span></th><th><span onclick="JavaScript:sort(\'name8\')" style="color:blue; cursor:hand;">name8</span></th><th><span onclick="JavaScript:sort(\'name9\')" style="color:blue; cursor:hand;">name9</span></th><th><span onclick="JavaScript:sort(\'name10\')" style="color:blue; cursor:hand;">name10</span></th><th><span onclick="JavaScript:sort(\'name11\')" style="color:blue; cursor:hand;">name11</span></th></tr>';

    for (l1=0; l1<length; l1++)
    {
     output += '<tr>';
     output += '<td>';
     output += object[l1].name1;
     output += '</td>';
     output += '<td>';
     output += object[l1].name2;
     output += '</td>';
     output += '<td>';
     output += object[l1].name3;
     output += '</td>';
     output += '<td>';
     output += object[l1].name4;
     output += '</td>';
     output += '<td>';
     output += object[l1].name5;
     output += '</td>';
     output += '<td>';
     output += object[l1].name6;
     output += '</td>';
     output += '<td>';
     output += object[l1].name7;
     output += '</td>';
     output += '<td>';
     output += object[l1].name8;
     output += '</td>';
     output += '<td>';
     output += object[l1].name9;
     output += '</td>';
     output += '<td>';
     output += object[l1].name10;
     output += '</td>';                                  
     output += '<td>';
     output += object[l1].name11;
     output += '</td>';                                  
     output += '</tr>';
    }

    output += '</table><div style="background-color:green; position:absolute; width:100px; height:100px; top:25px; left:25px; visibility:hidden;" id="menu"><a onclick="operation(0)"><u>Stop</u></a><br/><a onclick="operation(1)"><u>Start</u></a><br/><a onclick="operation(2)"><u>Pause</u></a><br/><a onclick="operation(3)"><u>Continue</u></a></div>';
    alert(output);
    parent.f3.document.write(output);
     
}




0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 75 total points
ID: 6155726
Put the table inside of a named:

<div id="thediv" style="position:absolute">
table stuff
<div>

The do the rewrite this way:

if (document.all)
{
   parent.f3.document["thediv"].innerHTML=output;
}
else
{
   if (document.layers)
   {
      parent.f3.document.layers["thediv"].document.write(output);
      parent.f3.document.layers["thediv"].document.close();
   }
}

That should overwrite the original table inside the div instead of appending the way it is doing now.

Cd&
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6155731
Looking at your code it looks like it is IE specific in whch case you don't need the whole thing; just:

  parent.f3.document["thediv"].innerHTML=output;

should do it.

Cd&
0
 

Author Comment

by:Prasanna23
ID: 6159074
HI Cd&,

You r simply Great. Million thanks to u. It worked. I owe u a drink.

Thanks a lot again,
Best Regards,
Prasanna
0
 

Author Comment

by:Prasanna23
ID: 6159082
Thanks
Best Regards,
Prasanna

0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6159192
Glad I could help.  Thanks for the A. :^)

Cd&
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question