1

I have a question about Palette in Wicket, i would add values (on page loading) in the right list but i didn't find a solution. I can only add values to left list using the Model. So please help me. (here in the pic, i would that the list Selected contains values from the beginning)

Thanks

Mohamed
  • 2,342
  • 4
  • 21
  • 32
  • Sorry, i couldn't add it to my post, you can see it here http://www.hostingpics.net/viewer.php?id=978465Sanstitre.png – Mohamed Jul 22 '11 at 06:58

2 Answers2

0

I am not sure if you can do this using current APIs of Palette. Since Palatte is a Panel behind the scene, and they use wicket ids hard coded like this (left is choice - right is selection) to populate,you can not load choices on the right hand side.

<td class="pane choices">
    <select wicket:id="choices" class="choicesSelect">[choices]</select>    
</td></td>
<td class="pane selection">
    <select class="selectionSelect" wicket:id="selection">[selection]</select>  
</td>

What you can do in my opinion (I am a novice,so pardon me if I sound foolish), take the Palette.html ,customize it(toggle the TDs),make your own CustomPalette that extends the Palette,and provide your own template panel. like:

<td class="pane selection">
    <select class="selectionSelect" wicket:id="selection">[selection]</select>  
</td> 
 ........//buttons
<td class="pane choices">
    <select wicket:id="choices" class="choicesSelect">[choices]</select>    
</td>

I did not try it though. good luck.

Shahriar
  • 825
  • 1
  • 15
  • 31
  • Thank you, it is interestng for me to know how to customize a wicket palette but i didn't understand your example, can you please explain more, or have you another example? – Mohamed Jul 25 '11 at 22:13
0

Palette has a constructor where you can pass two model objects: one for the items already selected and one for all the choices available.

biziclop
  • 48,926
  • 12
  • 77
  • 104
  • I tried to use the other constuctor: final Palette palette = new Palette("partners", new Model((Serializable) list1), new Model((Serializable) list2), renderer, 10, false); but always i have an empty right list :( – Mohamed Jul 22 '11 at 13:27
  • Note that the first model should contain the selected elements (the ones on the right), but the second model should contain **all** the elements, including the ones already listed in the first model. – biziclop Jul 22 '11 at 15:06