Wicket 6 ListItem add CSS

2013-05-31 Thread Tommy Sadiq Hinrichsen
Hey

I'm trying to add a css class to a tr field inside a ListView.

Here is the code

add(new ListViewFinanceAccount(financeAccounts, new
FinanceAccountListModelWithSum()) {
@Override
protected void populateItem(ListItemFinanceAccount itemOuter)
{
FinanceAccount fa = itemOuter.getModelObject();
itemOuter.add(new Label(accountNumber,
fa.getAccountNumber()));
itemOuter.add(new Label(accountName, fa.getName()));

switch (fa.getFinanceAccountType()) {
case PROFIT:
case EXPENSE:
case ASSET:
case LIABILITY: {
itemOuter.add(new Label(sum, fa.getSum()));
break;
}
case HEADLINE: {
itemOuter.add(new
AttributeAppender(class,test));
itemOuter.add(new Label(sum, ));
break;
}
case SUMFROM: {
//TODO calculate sum
itemOuter.add(new Label(sum, ));
break;
}
}
}
});

And the markup

 table class=table table-condensed
tr
th
wicket:message key=account.number/wicket:message
/th
th
wicket:message key=account.name/wicket:message
/th
th
wicket:message key=account.sum/wicket:message
/th
/tr
span wicket:id=financeAccounts
tr
td
span wicket:id=accountNumber/span
/td
td
span wicket:id=accountName/span
/td
td
span wicket:id=sum/span
/td
/tr
/span
/table

All that happens is that it creates a lot of span surrounding the tr
elements. Is it not possible to add a class directly to the tr element?



Med venlig hilsen / Best regards

Tommy Sadiq Hinrichsen


Re: Wicket 6 ListItem add CSS

2013-05-31 Thread Sven Meier

Put the wicket id on the tr tag:

tr wicket:id=financeAccounts
td
span wicket:id=accountNumber/span
/td
td
span wicket:id=accountName/span
/td
td
span wicket:id=sum/span
/td
/tr

Sven


On 05/31/2013 12:09 PM, Tommy Sadiq Hinrichsen wrote:

Hey

I'm trying to add a css class to a tr field inside a ListView.

Here is the code

add(new ListViewFinanceAccount(financeAccounts, new
FinanceAccountListModelWithSum()) {
 @Override
 protected void populateItem(ListItemFinanceAccount itemOuter)
{
 FinanceAccount fa = itemOuter.getModelObject();
 itemOuter.add(new Label(accountNumber,
fa.getAccountNumber()));
 itemOuter.add(new Label(accountName, fa.getName()));

 switch (fa.getFinanceAccountType()) {
 case PROFIT:
 case EXPENSE:
 case ASSET:
 case LIABILITY: {
 itemOuter.add(new Label(sum, fa.getSum()));
 break;
 }
 case HEADLINE: {
 itemOuter.add(new
AttributeAppender(class,test));
 itemOuter.add(new Label(sum, ));
 break;
 }
 case SUMFROM: {
 //TODO calculate sum
 itemOuter.add(new Label(sum, ));
 break;
 }
 }
 }
 });

And the markup

  table class=table table-condensed
 tr
 th
 wicket:message key=account.number/wicket:message
 /th
 th
 wicket:message key=account.name/wicket:message
 /th
 th
 wicket:message key=account.sum/wicket:message
 /th
 /tr
 span wicket:id=financeAccounts
 tr
 td
 span wicket:id=accountNumber/span
 /td
 td
 span wicket:id=accountName/span
 /td
 td
 span wicket:id=sum/span
 /td
 /tr
 /span
 /table

All that happens is that it creates a lot of span surrounding the tr
elements. Is it not possible to add a class directly to the tr element?



Med venlig hilsen / Best regards

Tommy Sadiq Hinrichsen




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org