on 11-13-2006 1:23 PM
Hi All
I am using the method removechild(int index) to remove textviews from a table container.
Please let me know how should i calculate the index of elements?
Does the index starts with 0 and increments by 1 as the UIElements are added to the container ?
I started a loop and removing the elements
for ( int iCtr = 0 ; iCtr < 8 ; iCtr += 1){
tblContainer.removeChild(iCtr);
}
This code is removing the elements randomly .
Pls help
Regards
Sonal Mangla
Hi,
Yes the index starts with 0.
It is wise to start at at 8 (or wdContext.nodeName.size()) and iterate down to 0.
e.g.
for (int i=8; i>=0; i--) {
}
Good luck, Roelof
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks All for the active participation and helping me out
My problem was resolved using resetview() method.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What do you mean with "table container"? From the used method "removeChild" I guess tblContainer is some IWDUIElementContainer.
Indices always start at 0, when removing elements using iteration by index, you should iterate from end to start. If the is an iterator with deletion, use that.
To remove children from their container, you have several possibilities:
IWDUIElement[] children = container.getChildren();
container.removeAllChildren();
/* children still alive but not any longer inside container */
container.destroyAllChildren();
/* children removed from container and destroyed */
int begin = ...;
int end = ...;
for (int index = end-1; indexx >= start; --indexx)
{
container.removeChild(index);
}
/* removes children between begin and (not including) end from the container */
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sonal
You need to downsize index to remove all the children.
for ( int iCtr = tblContainer.numberOfChildren() ; iCtrl>=0 ; iCtr--) {
tblContainer.removeChild(iCtr);
}
or just
tblContainer.destroyAllChildren();
BR
Sergei
Message was edited by:
Siarhei Pisarenka
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
if (firstTime) {
IWDTable table = (IWDTable) view.getElement("ShoppingBasket");
for(int i=0;i<table.numberOfColumns();i++)
{
table.removeColumn(i);
}
this helps for removing the columns from the table.
Thanks
Lohi.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try this
for(int i=0;i<tblContainer.numberOfChildren();i++)
{
grp.removeChild(i);
}
grp.removeChild(0);
Regards,Anilkumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.