on 10-06-2008 7:40 AM
Hi All,
I am getting the following exception in multiple row selection :-
java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
at java.util.ArrayList.RangeCheck(ArrayList.java:507)
at java.util.ArrayList.get(ArrayList.java:324)
at com.sap.tc.webdynpro.progmodel.context.Node$ElementList.getElement(Node.java:2034)
at com.sap.tc.webdynpro.progmodel.context.Node.isMultiSelected(Node.java:841)
at com.sap.tc.webdynpro.progmodel.context.Node.isMultiSelected(Node.java:839)
I have made the following settings :-
Cardinality : 0.n
Selection : 1.n
Selection Mode of Table : Multi
i am using value nodes in my Application.
Please suggest some solution
Thanks,
Nikhil
hi!
make sure "selectionmode" property is "multi" and also selection should be 0.. n.
and then In the controller program use the method "isMultiSelected" of the mapped Node to check whether the multiple lines are selected.
i am sending you the sample code to show the selected row indices
StringBuffer msg = new StringBuffer("Multi-selected rows:");
for (int i = 0; i < wdContext.nodeRows().size(); ++i)
{
if (wdContext.nodeRows().isMultiSelected(i))
{
msg.append(" ").append(i);
}
}
wdComponentAPI.getMessageManager().reportSuccess(msg.toString());
thanks
vishal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Try this code
for(int i=0;i<nodesize();i++)
{
if(wdContext.node<<abc>>.isSelected(i)
{
wdContext.node<<abc()>>.removeElement(wdContext.nodeabc().getabcElementat(i));
}
}
Regards
Raghu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
if you have any condition checking the node size ,make sure that the proper node using .
Regards,
ramesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Check your For loop iterator code or else post your code.
it should be like this
for(int i=0;i<wdContext.nodeABC().size();i++)
Regards
Raghu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
there may be some error in your code
like node.size()>=2
it must be node.size>2 not equal to
where 2 is the size of the node
where as the index starts from 0
jus correct ur code
ur settings of properties look alright
Regards,
Satya.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am using the following code for deleting 1 or more rows in a table :-
for (int j = 0; j < tableSize; ++j)
{
if (wdContext.nodeCn_Table().getLeadSelection() == j
|| wdContext.nodeCn_Table).isMultiSelected(j))
{
entry =wdContext.currentCn_TableElement(); wdContext.nodeCn_Table().removeElement(entry);
}
}
Nikhil
Edited by: NIKHIL GULATI on Oct 6, 2008 8:58 AM
hi,
try similar implementation for ur requirement.
int nelems = wdContext.nodePeople().size();
int lead =wdContext.nodePeople().getLeadSelection();
// checking if the lead selection is valid
for(int i=nelems-1;i<nelems;--i){
if(wdContext.nodePeople().isMultiSelected(i)||lead==i){
// deleting the element
wdContext.nodePeople().removeElement(wdContext.nodePeople().getElementAt(i));
}
Regards,
Satya.
Hi,
problem in your code,
for (int j = 0; j < tableSize; ++j)
{
if (wdContext.nodeCn_Table().getLeadSelection() == j
|| wdContext.nodeCn_Table).isMultiSelected(j))
{
// entry =wdContext.currentCn_TableElement(); replace this with below one
entry = wdContext.nodeCn_Table().getCn_TableElementAt(j);
wdContext.nodeCn_Table().removeElement(entry);
}
}
Regards,
ramesh
Hi ,
for (int j = 0; j < tableSize; ++j)
{
if (wdContext.nodeCn_Table().getLeadSelection() == j
|| wdContext.nodeCn_Table).isMultiSelected(j))
{
//add this code
wdContext.nodeCn_Table().setLeadSelect(j);
entry =wdContext.currentCn_TableElement();
wdContext.nodeCn_Table().removeElement(entry);
}
}
Regards,
Sunitha
Hi Satya,
Your code has removed the previous error and is working fine, but still two issues are left :-
1. There is performance issue with your code (very slow execution). But, I will check that again, as it may be server problem also.
2 . When I delete the last row in the table (single or multiple), I get the following error :- java.lang.NullPointerException
Can you throw some light on this.
Regards,
Nikhil
Hi Nikhil,
When deleting the records from the table, iteration should be in reverse order.
Can you try this, please?
for (int i = wdContext.nodeCn_Table().size() - 1; i >= 0; --i) {
if (wdContext.nodeCn_Table().getLeadSelection() == i
|| wdContext.nodeCn_Table).isMultiSelected(i))
{
wdContext.nodeCn_Table().removeElement(
wdContext.nodeCn_Table().getElementAt(i));
}
}
In Satya's code, the condition in for loop causing the problem. So try to change it as per my code.
Regards,
Siva
Edited by: Siva Rama Krushna on Oct 6, 2008 7:27 PM
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.