cancel
Showing results for 
Search instead for 
Did you mean: 

who can give me a example MultiSelected for ItemListBox

Former Member
0 Kudos

i have two itemListBox (asumed named A and B):

put A'selected elements into B by some action event.

when A got MultiSelected(no more one element get select).

i don't know how to get the selected element of A.

(Addition:how to fixed the hight of the ItemListBox)

thanks!

Accepted Solutions (1)

Accepted Solutions (1)

former_member182372
Active Contributor
0 Kudos

Hi,

Try to use this:


for (int j = 0, n = wdContext.nodeRows().size(); j < n; ++j)
{
  if (wdContext.nodeRows().getLeadSelection() == j
    || wdContext.nodeRows().isMultiSelected(j)
  {
    /* row at index j is selected */
  }
}

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

hi,Maksim Rashchynski

as u said:

1>it means i must iterator the total node element every times. i cann't get the Multi-LeadSelection elements of some node directly(e.g.:<b>int leadElement = wdContext.nodeA().getLeadSelection()</b>;)?

2>sir,if have put all the elements of A Node to the B Node. do u have any short-way?

<b>for(int i=1;i<=wdContext.nodeA().size();i++){

String selField =wdContext.nodeA().getAElementAt(i).getA();

PrivatePopView.IBElement newEle=wdContext.createBElement();

newEle.setB(selField);

wdContext.nodeB().addElement(newEle);;

}</b>

Former Member
0 Kudos

Hi,

You can get the multiselected elements using the code in the previous post and there is no default method like getMultiSelection() (that you are looking for).

You may use <a href="https://media.sdn.sap.com/html/submitted_docs/60_sp2_javadocs/webdynpro/com/sap/tc/webdynpro/progmodel/api/WDCopyService.html">WDCopyService</a> for copying elements between nodes.

Bala

former_member182372
Active Contributor
0 Kudos

You got already answer by Bala :-). Totally agree.

Former Member
0 Kudos

hi,Maksim Rashchynski

but i have met another matter!

i have two nodes named A and B.bind it to ListItemBox.

now i need to put the Selected element of node A to the node B by some event.the problem is:

<b>

for(int aLength=wdContext.nodeA.size(),int i=aLength;i>=0;i--)

{

if (wdContext.nodeA().getLeadSelection() == i|| wdContext.nodeA().isMultiSelected(i){

......//some operate.

<u>//you 'll find i=0 is always exist!although you don't select the the first item in ItemListBox.how to cancel it for default selected item?</u>

}

}</b>

former_member182372
Active Contributor
0 Kudos

Hi,

In your data source context node set property initializeLeadSelection to false. To set hieght of UI set visibleItems property of UI element to appropriate value.

Best regards, Maksim Rashchynski.

Former Member
0 Kudos

Hi,

Does setting the property "Initialize Lead Selection" to false solve this problem?

The 0th index element is selected by default inspite of setting the property to true.

Can anyone please help?

Thanks in advance,

Shruthi.

Edited by: Shruthi Vishwanath on Jan 18, 2012 10:21 AM

Former Member
0 Kudos

Hi,

The solution is to ensure that the selection cardinality of the node is 0-n along with the property InitializeLeadSelection set to false.

Regards,

Shruthi.

Answers (0)