I do it exactly like your describe in 2.
What is the error you are getting, can't see anything wrong with what you wrote
so far...
-Arno
David Michaels wrote:
I know this is a classic difficulty with XMLC, but I suspect there’s a
better solution out there than I’ve seen so far:
The issue is how to suppress an element (with children) on one table row
(say the first) and have it re-appear on subsequent table rows?
I see several options:
1. generate the element programmatically, and only add it to the DOM
tree for the rows in which it needs to appear
2. have the element in the mockup. Clone it before your loop begins and
remove it from the tree. Insert the clone back when necessary. Pro:
this keeps the mockup in it’s desired role: as the source of the
element. Con: I can’t get this to work! (DOM006 errors)
3. somehow disable the element for one row only, so it stays in the tree
but doesn’t get inserted in the page. I don’t know if this is
supported, but I think this would be the ideal extension to XMLC.
And a related question:
My loops to iterate thru table rows typically look like:
page.getElementTableRow();
while(…)
{
// modify table row as needed
table.appendChild(templateRow.cloneNode(true));
}
I do the cloning at the end because the only way to use the nifty
XMLC-generated accessor methods (getElementXXX()) is to access them from
the page. Having these accessors seems the primary value of XMLC, and
traversing the DOM manually seems to undermine the argument for using
XMLC at all. If somehow XMLC could generate an object for the row
itself, with methods for the row’s child elements, this would no longer
be necessary.
The downside is that I cannot remove elements from the template row
temporarily.
Do others typically clone at the end of the loop, or do you clone at the
beginning and then traverse the DOM of the cloned row manually?
Thx!
--
David Michaels <dkm@xxxxxxx <mailto:dkm@xxxxxxx>>
Director of Web Engineering
PGP Corporation (650) 319-9009
|