Martin,
Thanks for taking time to reply. I'll share more detail about the scenario.
zzzzz....
I'm building a treeview-like navigation interface, where the childnodes are
<A> elements.Each parent node in the tree has an empty DIV to hold its
childen. The tree is only two levels deep. The first major challenge is that
dataset that populates the treeview is so large that it cannot be downloaded
all at once for performance/latency reasons; so data are retrieved in
pieces, only as needed, upon node-expand. Only the first level is built upon
page load.
The data are fetched from the database via a hidden IFRAME conduit (instead
of XMLHTTP) and then, when the IFRAME's document has loaded (setTimeout,
readyState==complete) the contents of a DIV on the hidden IFRAME are moved,
as one block of html in one fell swoop into an empty DIV in the main page.
Each parent node has such a DIV for its child nodes. When the node is
collapsed the DIV is made invisible.
A second perhaps insurmountable challenge is that the customer wants the
treeview to be stateful without using postbacks. My choices, as I see them,
are to write back to the database via another hidden IFRAME or via XMLHTTP,
or to use cookies. Any other way to maintain state without using postback?
Remoting maybe. But for me, remoting is like The Paths of the Dead in LOTR.
I'll take that route last.
At the moment, I'm trying the cookie approach. The customer wants the
treeview to look exactly as it was -- all previously opened nodes still open
and populated-- when the user returns to the page after visiting another.
So, upon node-expand, I'm storing each DIV's worth of childnodes retrieved
from the database in a separate session cookie; each populated DIV has its
own cookie which contains the DIV's innerHTML. When the treeview page is
loaded, I read those cookies and repopulate each childnode DIVs in my
OpenNodesList (also stored as a cookie).
Problem: my code works in the IE debugger but often not at runtime.
Sometimes the DIVS do not get repopulated. So I'm assuming there's a timing
issue between reading the cookie and writing to the DIV. Sometimes the
cookie might contain 20K. I'm in a tight loop reading cookies and with each
iteration inserting a block of HTML into the target DIV:
PSEUDOCODE:
for each node in OpenNodesList
// myData contains a series of <A> elements
// DIV is empty before the insert
myData = GetCookie(node)
getDIV(node).insertAdjacentHTML = myData
I'll find the non-proprietary way to insert the HTML into the target DIV
after I've proved (or disproved) the viability of the concept in IE. But is
the above loop actually feasible? GetCookie would also have to be
synchronous, right?
Timo
"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:40********@olaf.komtel.net...
:
:
: : I don't see why it would makes sense to insert a HTML element with
: insertAdjacentHTML so I guess if the element with id data is a form
: control you want
:
: myDIV.insertAdjacentHTML("afterBegin",
: myIFRAME.window.document.getElementById('data').va lue)
:
: or if it is a HTML container element you want
:
: myDIV.insertAdjacentHTML("afterBegin",
: myIFRAME.window.document.getElementById('data').in nerHTML);
:
: but I don't see a timing problem, document manipulation happens
: synchronously as long as you do not insert elements which load external
: resources.
:
: However you whole scripting seems to be geared towards the IE object
: model as insertAdjacentHTML is not part of the W3C DOM so consider to
: change to the W3C DOM if you want to build a page working with as many
: of the modern browsers as possible.
:
: --
:
: Martin Honnen
:
http://JavaScript.FAQTs.com/
: