【发布时间】:2014-01-27 20:09:44
【问题描述】:
有谁知道如何在 jQuery 数据表中添加额外的列?我有一个包含五列的 jQuery 数据表,我想添加两个额外的列。
<table class="table table-bordered table-striped table_vam" id="dt_gal">
<thead>
<tr>
<th class="table_checkbox">
<input type="checkbox" name="select_rows" class="select_rows" data-tableid="dt_gal" />
</th>
<th>Product Name</th>
<th>Product Code</th>
<th>Description</th>
<th>Start Price</th>
<th>Reg Fee</th>
<th>DateCreated</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<c:forEach var="product" items="${PRODUCTS}">
<tr>
<td>
<input type="checkbox" name="row_sel" class="row_sel" />
</td>
<td>${product.productname}</td>
<td>${product.code}</td>
<td>${product.description}</td>
<td>${product.startPrice}</td>
<td>${product.registrationFee}</td>
<td>${product.dateCreated}</td>
<td><a href="${PREFIX}/product?edit=true&id=${product.id}" class="sepV_a" title='Edit'><i class='icon-pencil'></i>
Edit </a>
<!-- <a href="#" title='Delete'><i class='icon-trash'></i></a></td> -->
</tr>
</c:forEach>
</tbody>
</table>
我编辑了下面的块,但没有成功,因为表格没有显示从var iListLength = 5; 到 var iListLength = 7;
"fnUpdate": function ( oSettings, fnDraw ) {
var iListLength = 5;
var oPaging = oSettings.oInstance.fnPagingInfo();
var an = oSettings.aanFeatures.p;
var i, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
【问题讨论】:
-
您使用的是服务器端还是客户端数据源?您要添加的两列是数据源的一部分还是只是任意列?另外,您可以发布您的
dataTable配置部分吗? -
嗨皮特,它的服务器端。我正在使用 jquery.datatables.bootstrap.min.js,我在 .jsp 文件中发布了上面的示例。
-
您是否已经为您的问题确定了一个可接受的解决方案?
-
嗨皮特,是的..已经发布了解决方案
标签: jquery jquery-ui jsp twitter-bootstrap datatables