Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
nested repicant containers
maggi
I have the following structure.
container
----replicant container (1) (max-7)
----replicant container (max - unbo unded)
-------replicant container (max - unbounded)
-----------replicant container(max - 7) (2)
How do you iterate thru the replicant conainter (deeper level) and get the values. I have a radio button item before this container...based on this radio button value, lets say 2, I have to show only 2 replicants from for (1) and (2-deep level) replicant containers. have to hide the rest of the replicants. How do u address nested replicant containers and iterate it through formAPI.
I did search on this forum but i couldn't get much info.
Any tips, suggestions, snippets code will be much appreciated.
Maggi
TeamSite 6.5/Unix
Find more posts tagged with
Comments
jbonifaci
Check out .getChildren().
But, unless something has changed it 6.5 from 6.1, I don't believe you can show/hide containers. I would recommend deleting/adding them based off of the value in your select.
~Jeff
maggi
hey can u show some sample code for deleting and adding replicants based on the value.
Thanks
Maggi
maggi
getChildren() retrieve for one level only. I want to iterate the replicants for the 3rd level replicant container
jbonifaci
Check out the documentation on
.addInstance
and
.deleteInstance
.
~Jeff
jbonifaci
You can call
.getChildren
on any level container/replicant, just call it on the replicant you want to get the children for.
~Jeff
maggi
i know it suppose to work any level. may be i am not addressing properly.
my container address : /a/b/e/f/g
a - root container
b - main container
e - replicant container (max - unbounded)
f - replicant container for e (max - unbounded)
g - replicant container for f (max - 7)
If i know the no of replicant i can assign /a/b/e[1]/f[1]/g[1], lets say if the dropdown value is 2
then i have go iterate like this
/a/b/e[1]/f[1]/g[1]
/a/b/e[1]/f[1]/g[2]
/a/b/e[1]/f[2]/g[1]
/a/b/e[1]/f[2]/g[2]
/a/b/e[1]/f[3]/g[1]
/a/b/e[1]/f[3]/g[2]
......
/a/b/e[2]/f[3]/g[1]
/a/b/e[2]/f[3]/g[2]
/a/b/e[3]/f[3]/g[1]
/a/b/e[3]/f[3]/g[2]
..............
jbonifaci
The below code (untested) should help you with iterating through your replicants:
var eItemArray = IWDatacapture.getItem('/a/b/e').getChildren();
for (var eItem=0; eItem<eItemArray.length; eItem++)
{
var fItemArray = IWDatacapture.getItem(eItemArray[eItem].getName()+'/f').getChildren();
for (var fItem=0; fItem<fItemArray.length; fItem++)
{
var gItemArray = IWDatacapture.getItem(fItemArray[fItem].getName()+'/g').getChildren();
for (var gItem=0; gItem<gItemArray.length; gItem++)
{
alert(gItemArray[gItem].getName());
}
}
}
~Jeff
maggi
jeff,
Thank you so much...u r the king!!!
Maggi
maggi
jeff,
I can retrieve the replicants only e level not f and g level. I don't see anything wrong in this code.
Maggi
jbonifaci
I haven't tried using it yet, but you can try using the
getChildByName
method instead:
var eItemArray = IWDatacapture.getItem('/a/b/e').getChildren();
for (var eItem=0; eItem<eItemArray.length; eItem++)
{
var fItemArray = eItemArray[eItem].getChildByName('f').getChildren();
for (var fItem=0; fItem<fItemArray.length; fItem++)
{
var gItemArray = fItemArray[fItem].getChildByName('g').getChildren();
for (var gItem=0; gItem<gItemArray.length; gItem++)
{
alert(gItemArray[gItem].getName());
}
}
}
~Jeff