473,401 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

force rendering after dom modification

Hi all,

I'm writing a widget that should enable the user to choose some item
from a huge list that has a tree structure (~23000 items, node with max
children = ~1600 kids (only 3 levels in the tree...)).
The widget is basicalli a list, each element has two span tags that call
javascript functions on mouse click (one to choose the item and the
other to expand it) and eventually another list if the item is expanded.
When a user expand a node I use a XMLHttpRequest to retrive the node
children from the server without reloading the page.

Here is my problem: if I use the response to create all the pieces to
"draw" the list of children, the browser has to do a lot o processing
and it is too slow (~15 sec.) when a node has more than 400 children
(here I do something like
var xxx = document.createElemente("li");
var yyy = document.createElemente("span");
xxx.setAttribute(...);
yyy.appendChild(xxx);
ecc.).
Otherwise, if I prepare the list on the server (with all tags and
attributes in place) and just add the root node of the response to the
expanding node, then I don't get any rendering for this piece of added
html (no style, no mouse interaction), even if the source of the page
looks correct (here I do something like
var list = responseXML.getElementsByTagName("ul")[0];
currentNode.appendChild(list);
)

So my question is:
can I force the browser to re-render a page in some way, after I append
my new list?
or
any suggestions?
(if possible I'd like not to use window.open(...) even if it seems to
solve my problem :-) )
Thank you
Matteo
Apr 10 '06 #1
2 5901
Gamboz Matteo wrote:
Hi all,

Here is my problem: if I use the response to create all the pieces to
"draw" the list of children, the browser has to do a lot o processing
and it is too slow (~15 sec.) when a node has more than 400 children
(here I do something like
var xxx = document.createElemente("li");
var yyy = document.createElemente("span");
xxx.setAttribute(...);
yyy.appendChild(xxx);
ecc.).
Otherwise, if I prepare the list on the server (with all tags and
attributes in place) and just add the root node of the response to the
expanding node, then I don't get any rendering for this piece of added
html (no style, no mouse interaction), even if the source of the page
looks correct (here I do something like
var list = responseXML.getElementsByTagName("ul")[0];
currentNode.appendChild(list);
)

So my question is:
can I force the browser to re-render a page in some way, after I append
my new list?
or
any suggestions?


What you have may work in other browsers, but not in IE, where you can't
add received XML to the DOM. You might be able to use responseData (not
XML) and innerHtml, assuming you don't exceed any size limits.

The DOM is live, so any (visible) elements added will be displayed.

--
Ian Collins.
Apr 10 '06 #2
Ian Collins wrote:
Gamboz Matteo wrote: ....
expanding node, then I don't get any rendering for this piece of added
html (no style, no mouse interaction), even if the source of the page


What you have may work in other browsers, but not in IE, where you can't
add received XML to the DOM. You might be able to use responseData (not
XML) and innerHtml, assuming you don't exceed any size limits.


Thank you I'll try this way.

The DOM is live, so any (visible) elements added will be displayed.


Yes, sorry, I didn't mean that I can't see the elements; in fact I do
see the elements, but they are rendered as plain text.
In the source of the page I see the whole element (tab, attributes,
etc.), but in the browser window I see only the textContent of my nodes.
Maybe it is just that I can't put the received XML directly into the DOM
as you said. Could you point me to some documentation of this?

Thank you,
Matteo
Apr 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Konstantin Zakharenko | last post by:
Hello, Our QA team have running a lot of test scripts (for automated regression testing), they run them on the different databases (Oracle/MS SQL). Several of those tests are dependent on the...
133
by: Philipp Lenssen | last post by:
Why is there no standardized and well-working way for a web-page to offer the font for download/embed it, in order to be displayed on the page? No matter what you think of the preferred font of a...
3
by: Pint | last post by:
I would like to know if there is a programatic way to force the Application object to restart. I have a hosted website where I will be unable to control the webserver (eg:iisreset), and I would...
3
by: aaa | last post by:
I am checking if a certain object is null and if it is I need to go back to ther server and get this object can I force a postback in the code behind and if so how?
4
by: John Lafrowda | last post by:
Hi all, I'm trying to handle two projects in one solution (.net 2002, both projects are VB). The first project contains only some public constant definitions (for the moment) and compiles into...
10
by: Fred Nelson | last post by:
Hi: I have a VB.NET web application and I need to find a way to cause a page refresh from within my application. Does anyone know how to force the browser to refresh the current page? ...
5
by: annagel | last post by:
I am looking for a way to force a Tkinter window into focus on a system level. I know the force focus method should bring one window of my application into focus, but it seems I need to have some...
1
by: Cédric | last post by:
Hello, Wanting to create a thumbnail of an image, i'm using the following piece of code : Public Sub Reduction(ByVal Source As String, ByVal Destination As String, ByVal TailleX As String,...
0
by: Veazer | last post by:
I'm trying to install the Windows Media 11 codecs (WMFDIST11-WINDOWSXP-X86-ENU) on a Win2K3 server box used that will be used for encoding video. Unfortunately MS does not officially support the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.