0
属性display-name〜<td>
の値にwicket idという値を追加する必要があります。Wicketを使用してhtml要素に属性を追加する
<tbody>
<tr wicket:id="result" class="bgalternate1">
<td wicket:id="values">
<span wicket:id="value">Value</span>
</td>
</tr>
</tbody>
期待される結果は、<td>
に属性「表示名」を追加することができませんでし望ましい結果を達成することができない私は、Javaコードの下に使用して試してみました
<tbody>
<tr class="bgalternate1">
<td display-name="<attribute_name>"> <!--attribute is column header -->
<span wicket:id="value">Value</span>
</td>
</tr>
</tbody>
、すなわちです。 SimpleAttributeModifierは非推奨であり、AttributeModifierを使用していたため、当初はSimpleAttributeModifierを使用していました。
public ReportResultPanel(final String id, final IModel<AdHocReportSetup> model)
{
super(id, model);
setOutputMarkupId(true);
final IModel<Paging> pagingModel = new Model<Paging>(new Paging());
resultModel = createResultModel(model, pagingModel);
addResults(this, "result", resultModel);
}
private ListView<AdHocReportResult> addResults(final MarkupContainer parent,
final String id,
final IModel<ReportResultModel> model)
{
final IModel<List<AdHocReportResult>> resultsModel = new PropertyModel<List<AdHocReportResult>>(model, "results");
final ListView<AdHocReportResult> result = new ListView<AdHocReportResult>(id, resultsModel) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<AdHocReportResult> item)
{
addResultValues(item, "values", item.getModel());
AdHocPage.applyParityClass(item.getIndex(), item);
final Behavior behavior = AttributeModifier.append("display-name", "red");
for (final Component next : item)
{
next.add(behavior);
}
}
};
parent.add(result);
return result;
}
private ListView<AdHocReportResultAttribute> addResultValues(final
MarkupContainer parent, final String id,
final IModel<AdHocReportResult> model)
{
final IModel<List<AdHocReportResultAttribute>> attributesModel = new PropertyModel<List<AdHocReportResultAttribute>>(
model, "attributes");
final ListView<AdHocReportResultAttribute> result = new ListView<AdHocReportResultAttribute>(id, attributesModel) {
private static final long serialVersionUID = 1L;
@Override
protected void populateItem(final ListItem<AdHocReportResultAttribute> item)
{
addValueLabel(item, "value", item.getModel());
}
};
parent.add(result);
return result;
}
@ martin-gありがとうございます。私はあなたが言及したのと同じ方法で昨日(5/17)それを修正しました。 '--- { addValueLabel(item、" value "、item.getModel()); item.add(AttributeModifier.append( "表示名"、 "赤"); ) ---- ' – ChilBud