Wicket Palette - add values to left list
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
Palette
has a constructor where you can pass two model objects: one for the items already selected and one for all the choices available.
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.
精彩评论