• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using Applet to speed up hiding of elements

 
Darren Alexandria
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day!

I have a table inside a table. Each sub-table is inside a <td>.
I have put an ID in each of those <td>'s so that whenever I
want to hide other sub-tables, I'll just access the <td> ID
through javaScript and hide it. It was supposed to be a breeze.
And it did for most cases. But my problem now is that I have a
sub-table which contains thousands of data and it loads so slow.

I have an idea which is to use my applet class code and "declare"
the hiding in there. Can I put code like this in there?

<CODE>
document.getElementById(tdID).style.display = 'none';
</CODE>

here's a snippet of my applet code:

<CODE>
win = JSObject.getWindow(this);
doc = (JSObject)win.getMember("document");

genForm = getParameter("genForm");
form = (JSObject)doc.getMember(genForm);

genField = getParameter("genField");
field = (JSObject)form.getMember(genField);

txtSendMsg.setText((String) field.getMember("value"));
</CODE>

Can I apply similar style to the javaScript code that I mentioned earlier?
can it speed up my hiding?

Thanks.
 
Paul Clapham
Sheriff
Posts: 21554
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't know if you can do that, but it really isn't obvious to me why you think the Javascript would run faster if you called from an applet instead of calling it directly. Or have I misunderstood your idea?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I, too, have no idea if it will be faster, but using the Common DOM API you can manipulate the page's DOM tree directly from within an applet. That should at least be more straightforward than using LiveConnect.
 
Darren Alexandria
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your replies. Actually, my applet code is composed of
this:



I have tried using javaScript directly and it is really slow when it
comes to large tables. If the applet thing will not work, can you please
give me some advice or suggestions?

Thanks a lot.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if (keyText == "Enter")

You should never use "==" to compare strings; it tests object equality, not string equality. Use the String.equals method instead.
 
Darren Alexandria
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay, thanks for correcting me.
How about some advice on how to speed up the hiding thing?

Thanks.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you've tried the Common DOM approach, and it isn't fast enough either?

There are ways to change the stylesheet directly, so that all elements that are part of a particular class are changed all at once. That would be a question for the HTML/JavaScript forum, though.
[ June 27, 2008: Message edited by: Ulf Dittmer ]
 
Darren Alexandria
Ranch Hand
Posts: 185
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for your suggestion.
Ok, I'll post my inquiry in the HTML/JavaScript Forum.

God bless.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic