>> Every 5 secs fresh data is downloaded from the server. The
downloaded[color=blue][color=green]
>> data is compared against the data currently being displayed in the
>> table. If any of the cells have changed, the javascript updates the
>> value of the cell and changes the cell color based on whether the
>> change is positive or negative from the previous value.[/color][/color]
[color=blue]
>This is not email. Your answer is read by many, so PLEASE quote a[/color]
relevant[color=blue]
>part of the original. Follow usenet netiquette.[/color]
I am using
http://groups.google.com which has pretty much gmail like
threaded view, so didnt realize the problems other face. Will
copy+paste the relevant parts ... sorry and thanks.
[color=blue]
>Downloaded to a HTML table, how, why?
>Then you loose the original table cell content, I suppose.
>I suggest you do such comparing on the server, not on the client[/color]
browser.
Ok ... let me try to elaborate on the problem. The application shows
the prices of stocks being traded in a web page. When a user logs in to
the application, they can select the stocks they are interested in.
They are then taken to a page which shows the price [and other details]
of the stocks in the form of a table. Every 5 secs there is a script
which downloads the new price list [in csv format] and updates the
cells which have changed. The background colour of the cell is changed
based on whether the new value of the cell is more/less than the
current value.
We did consider forming the HTML [with new background colours] on the
server side. This increases the CPU load on the server side. The
current model uses client side CPU to do the rendering and it works
fine in case of the rich client and incase of firefox browser. The
problem is only with IE. Once the page is loaded in IE, it takes 100%
CPU for couple of mins and then drops for a sec or so and then it takes
off again.
I donot think it is a problem with changing the style of the cells.
Just updating the cell values takes up a whole lot of CPU:
function updateTableCells()
{
var tbl = document.getElementById("tbl");
var tds = tbl.getElementsByTagName("td");
for(var k=0; k<tds.length;k++)
{
tds[k].firstChild.nodeValue = kk;
kk++;
if(kk>10000)kk=5000;
}
}