一段时间以来,我一直在使用蒲公英数据表和数据属性。
我昨天开始使用 url 属性,现在我无法自定义列。
我有以下内容:
<datatables:table id="statesTable" url="/find" pipelining="true" cssClass="table table-striped" pagingType="bootstrap_simple" dom="tip">
<datatables:column property="name" titleKey="name.label"/>
<datatables:column titleKey="actions.label">
<div class="btn-group">
<spring:url value="update" var="updateUrl">
<spring:param name="statusId" value="${id}"/>
</spring:url>
<a href="${updateUrl}"><fmt:message key="actions.update"/></a>
</div>
</datatables:column>
</datatables:table>
返回的数据是:
[{"id":7,"createdBy":"pedadmin","createdDate":1449765659000,"name":"Test"},
{"id":8,"createdBy":"pedadmin","createdDate":1449765744000,"name":"Otro"},
{"id":11,"createdBy":"pedadmin","createdDate":1449766460000,"name":"asdfasdfasdf"},
{"id":12,"createdBy":"pedadmin","createdDate":1449766539000,"name":"asañdsfadsfasfdfsad"},
{"id":13,"createdBy":"pedadmin","createdDate":1449766573000,"name":"asdfasdf"}]
生成的 HTML 是:
<tbody>
<tr role="row" class="odd">
<td class="sorting_1">asañdsfadsfasfdfsad</td><td></td>
</tr>
<tr role="row" class="even">
<td class="sorting_1">asdfasdf</td><td></td>
</tr>
<tr role="row" class="odd">
<td class="sorting_1">asdfasdfasdf</td><td></td>
</tr>
<tr role="row" class="even">
<td class="sorting_1">Cinco</td><td></td>
</tr>
<tr role="row" class="odd">
<td class="sorting_1">Cuatro</td><td></td>
</tr>
<tr role="row" class="even">
<td class="sorting_1">Dos</td><td></td>
</tr>
<tr role="row" class="odd">
<td class="sorting_1">Feo</td><td></td>
</tr>
<tr role="row" class="even">
<td class="sorting_1">Foobar</td><td></td>
</tr>
<tr role="row" class="odd">
<td class="sorting_1">Otro</td><td></td>
</tr>
<tr role="row" class="even">
<td class="sorting_1">Test</td><td></td>
</tr>
</tbody>
如您所见,自定义列的 td 中没有任何内容。为了使自定义列正常工作,我需要配置一些东西吗???(我使用数据而不是 url 测试了同一列,并且效果很好)
谢谢!