This Question is Possibly Answered

1 "correct" answer available (4 pts) 2 "helpful" answers available (2 pts)
3 Replies Last post: Jan 31, 2007 5:14 PM by Tatyana Matveyeva  
samaneh   2 posts since
Jan 24, 2007
Currently Being Moderated

Jan 24, 2007 9:34 AM

problem with twoListSelection component

hi,

I have used twoListSelection Component in my project.

at first step I bind  available items  to left List , then i  drop some of items to right List ,after that ,i save available i and  selectedI tems in database.

 

at second step i need to load both of lists(available and selected ) in a twoListSelection component and edit items.

for example droping more items to right list ,or removing some items from right list ,or changing order of selected items.

 

I dont know how to bind selected items to right List.

i any body knows ,plz help me.

thanx

samaneh

Tatyana Matveyeva   873 posts since
Aug 16, 2006
Currently Being Moderated
1. Jan 24, 2007 1:49 PM in response to: samaneh
Re: problem with twoListSelection component

Hello Samaneh,

 

List of selected items (right list) should be specified with value attribute of the .

 

Please feel free to ask us if you have any further questions.

 

Regards,

Tatyana

Tatyana Matveyeva   873 posts since
Aug 16, 2006
Currently Being Moderated
3. Jan 31, 2007 5:14 PM in response to: samaneh
Re: problem with twoListSelection component

Hello Samaneh,

 

I think that there is some misunderstanding in your usage of the TwoListSelection component. It should be used the same as any of UISelectMany JSF components.  The value attribute of the* f:selectItems* component should be bound to a list of all available items. It means that this list should contain items for both (left and right) lists. In your case, it should be as follows:

 

itemList.add(new SelectItem("Item1","Item1"));
itemList.add(new SelectItem("Item2","Item2"));
itemList.add(new SelectItem("Item3","Item3"));
itemList.add(new SelectItem("Item4","Item4"));

 

And the value attribute of the q:twoListSelection component should be bound to a list or array of objects that correspond to the itemValue property of f:selectItems component. Given the fact that the itemValue is specified as String, that value attribute of the q:twoListSelection component should be bound to a list or array of String objects.

 

So, if you know itemValue for the item that should be selected, you should specify the following:

 

selectedItemList=new ArrayList();
selectedItemList.add("Item4");

 

Feel free to ask us any further questions.

 

Regards,

Tatyana

More Like This

  • Retrieving data ...