OK, so I am building a table, my DCT is a replicant of Row with children named Column.
Something like this:
[html]
Column
[/html]
The idea is that if I have 5 columns in the 1st row, when a new row is added, it should have 5. I am not worrying about someone added/removing in the middle yet. But I want when a Row is added, to add the # - 1 to the new Row.
I have a OnReplicantAdded:
IWEventRegistry.addItemHandler("/Root/Table/Row","onReplicantAdded", addCol);
which runs:
function addCol(item)
{
var Xpath = item.getName();
var firstRowItem = IWDatacapture.getItem(Xpath+"/../Row[1]/Column");
var numMainCols = firstRowItem.getChildren().length;
var newCol = numMainCols-1;
item.addInstance(newCol);
alert("Done adding "+newCol+" cols to "+item.getName());
return true;
}
It tells me Done adding 3 cols to /Root/Table/Row[2]
but I get the one default.
Tips/Pointers/RTFMs appreciated
Andy