Thank you so much for you explanation.
I had to put the two <tr> inside the <wicket:container> because I need to
repeat every two rows.
Do you have any hint on how to do it and still be able to change the color?



On Thu, Mar 16, 2017 at 12:36 PM, ganea iulia <superbiss...@gmail.com>
wrote:

> Thank you so much for you explanation.
> I had to put the two <tr> inside the <wicket:container> because I need to
> repeat every two rows.
>
>
>
> On Thu, Mar 16, 2017 at 11:26 AM, Sven Meier <s...@meiers.net> wrote:
>
>> Hi,
>>
>> it seems your ListView is bound to the <wicket:container
>> wicket:id="forEachItem"> tag, which cannot be styled.
>>
>> Change your markup to:
>>
>>   <tbody wicket:id="itemsContainer">
>>     <tr wicket:id="forEachItem">
>>
>> Have fun
>> Sven
>>
>>
>> On 16.03.2017 09:58, ganea iulia wrote:
>>
>>> Hello,
>>>
>>> I have a listview and I want to dinamically color some of the rows
>>> (items).
>>> But it is not working, nothing gets colored when it should.
>>>
>>> *Here is the markup:*
>>> <tbody wicket:id="itemsContainer">
>>> <wicket:container wicket:id="forEachItem">
>>> <tr>
>>> <td rowspan="2"><input type="checkbox" wicket:id="itemCheck" /></td>
>>> <td wicket:id="item1">[item1]</td>
>>> <td wicket:id="item2">[item2]</td>
>>> <td wicket:id="item3">[item3]</td>
>>> <td wicket:id="item4">[item4]</td>
>>> <td wicket:id="item5">[item5]</td>
>>> <td wicket:id="item6">[item6]</td>
>>> <td wicket:id="item7">[item7]</td>
>>> <td wicket:id="item8">[item8]</td>
>>> <td wicket:id="item9">[item9]</td>
>>> <td wicket:id="item10">[item10]</td>
>>> </tr>
>>> <tr>
>>> <td colspan="11" align="center" style="border-bottom: thin solid
>>> gray;"><textarea wicket:id="itemArea" rows="3"
>>> cols="100">Area</textarea></td>
>>> </tr>
>>>   </wicket:container>
>>> </tbody>
>>> </table>
>>>
>>> *Here is the code:*
>>>
>>> @Override
>>> protected ListItem<Items> newItem(final int index, IModel<Items> model) {
>>> return new ListItem<Items>(index, getListItemModel(getModel(), index)) {
>>>
>>> @Override
>>> protected void onComponentTag(final ComponentTag tag) {
>>> Items line = getModelObject();
>>> if (line.getIdLn() == 6)
>>> tag.put("style", "background-color:green");
>>> else if (line.getIdLn() == 4 )
>>> tag.put("style", "background-color:red");
>>>
>>> // continue with default behavior
>>> super.onComponentTag(tag);
>>>
>>> }
>>> };
>>> }
>>>
>>> Could you please advise?
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
>> For additional commands, e-mail: users-h...@wicket.apache.org
>>
>>
>

Reply via email to