【问题标题】:Display:table : how to add an attribute to a row显示:表:如何将属性添加到行
【发布时间】:2018-08-25 00:13:02
【问题描述】:

我想在表格的一行中添加一个工具提示(属性标题)。 该表是在带有 taglib display:table 的 jsp 中构建的,看起来像这样(简化)。

<display:table class="list" id="row" name="listResultat" decorator="dyndecorator">
    <display:column property="dateEnvoieDt" title="Date envoi" ></display:column>
<display:table>

生成的代码是:

<table id="row" style="width:100%;" class="list" cellspacing="0">
    <thead>
        <tr>
            <th class="orderSortable sortable sorted order1">Date envoi</th>
        </tr>
    </thead>
    <tbody>
        <tr class="odd">
            <td>18</td>
        </tr>
        <tr class="even">
            <td>19</td>
        </tr>
    </tbody>
</table>

我想添加这样的标题:

<tr class="odd" title="18">
...
<tr class="even" title="19">

我尝试过使用装饰器,但找不到方法。 有人可以帮忙吗?

【问题讨论】:

  • &lt;display:...&gt; 指的是什么taglib?
  • 指displaytag

标签: jsp taglib displaytag


【解决方案1】:

我在每个 display:column 中添加了一个 span,但它并不干净。

<display:column property="dateEnvoieDt" title="Date envoi" >
    <span title='<bean:write name="codeAno"/>'>
        <bean:write name="row" property="dateEnvoieDt" format="dd/MM/yyyy" />
    </span>
</display:column>

【讨论】:

    【解决方案2】:

    我设法通过将标题属性“注入”到TableDecoratoraddRowClass() 方法中来为一行(tr 元素)添加标题属性:

    public class MyTableDecorator extends TableDecorator {
      @Override
      public String addRowClass() {
        return "these are css classes\" title=\"this is the title";
      }
    }
    

    (考虑到 displaytag 会为你添加双引号。)

    【讨论】:

      猜你喜欢
      • 2021-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-08-15
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多