Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X
Hi all,
I have a table XUI that I am working on, it is working pretty well. But I now what to add some more functions and they are giving me trouble. I want to remove the rowsep or colsep at the row and entry level. Here is the function I wrote:
function removeSep ( oid, attname )
{
var i,j; // local index variables
var entryChildren;
var oidChildren = oid.childNodes; // the oid passed was the tbody so this give me the rows
for (i=0; i <= oidChildren.length; i++ )
{
Application.alert ("remove seperators for i "+i+attname+" "+oidChildren.item(i).nodeName+" "+oidChildren.length );
oidChildren.item(i).removeAttribute(attname); // all the variables display correctly what I want
entryChildren = oidChildren.item(i).childNodes; // here are the entry children of the row
for (j=0; j <= entryChildren.length; j++)
{
Application.alert ("remove seperators for j "+j+attname+" "+entryChildren.item(j).nodeName+" "+entryChildren.length+" att= "+ entryChildren.item(j).getAttribute(attname)); // displays correct information
entryChildren.item(j).removeAttribute(attname);
} // end for j
Application.alert ("Outside the j loop"); // not getting here -- java exception occurs
} // end for i
}
I turned on the java console to debug, but didn't get any useful information (at least that I could understand). I have also used JSLINT on the internet to check my code syntax and everything checks there.
Any ideas?
Ellen
Addition.....
I was just looking at the table markup:
<row valign="middle">
<entry colname="1" morerows="2" align="left">
<para><emphasis type="bold">XX</emphasis></para>
</entry>
<entry colname="2" morerows="2" align="left">
<para>YYY.</para>
</entry>
</row><row valign="middle">
<entry></entry></row>
When I was displaying this table in markup mode, if I had the cursor in the empty cell the function didn't see that I was in a table. All the table functions on the table menu were grayed out. Is that what is causing the java exception?
Ellen
Thanks Clay,
I remember changing to <= on one of my tries of doing something and thinking that wasn't quite right, but it seemed to fix something at the time.
The reason I am doing this code is because I am changing things at the table level, that might have been overwritten by lower level attributes. We have some "standard" table stylesthe users are suppose to use and needed a way to change that style without the user needing to know what all the attribute settings are for the "standard" table style they picked. So yes the code looks strange out of context, but really is what I want to do. 🙂
Ellen
Hi again,
My loops are working fine.... BUT now the removeAttribute call sometimes works, but most of the time it causes Arbortext to crash. I can't figure out the rhyme or reason for when it works and when it doesn't. Has anyone else seen something like this?
Thanks,
Ellen
I do sometimes get this error message:
Runtime Error!
Program: ....epic.exe
R6025
- pure virtual function call
Does that mean anything to anybody?
In Reply to Ellen Headrick:
Hi again,
My loops are working fine.... BUT now the removeAttribute call sometimes works, but most of the time it causes Arbortext to crash. I can't figure out the rhyme or reason for when it works and when it doesn't. Has anyone else seen something like this?
Thanks,
Ellen
I googled (is that a word now?) the error message and it said to uninstall the program and reinstall and it should go away. Well the error message has gone away but nowArbortext just crashes without any message!
Ellen
In Reply to Keith Berard:
Sadly, our users have grown to recognized that error as a daily
reminder to save more often.
Clay,
Thanks again.
I had narrowed it down the to the removeAttribute line of code. I just tried your suggestion about turning off the table editor and that worked. I just don't know how to turn off the table editor from within my javascript. I have been looking around the the Arbortext code to see how they do it with the menu choice, but it hasn't made sense to me yet. 🙂
Ellen
In Reply to Clay Helberg:
Hi Ellen-
You might try adding some alerts to your code (or write messages to a
file) to help you get a sense of exactly which operation is causing the
crash.
FWIW, the table editor can be touchy. It may not like the way you are
modifying the data model out from under it. As a quick test, you could
turn on table tag view (which disables the table editor), then run your
script and see if it still crashes. If the crashes go away when you have
table tags turned on, then you know it's the table editor that's
throwing hissy fits.
The AOM has a separate, dedicated set of interfaces for dealing with
table objects: TableObject, TableCell, TableGrid, etc. See the
Programmer's Reference for details. I wonder if you would have better
luck making your changes with that approach instead of the standard DOM
interfaces for modifying nodes and attributes directly. Alternatively,
you could try temporarily switching to table tag view, doing your
operation, and then switching back at the end.
--Clay