【发布时间】:2015-06-09 12:56:33
【问题描述】:
我想更改由 jQuery Datatable 插件生成的数据表的列的标题
你知道我是否可以这样做:
table = $('#example').DataTable({
"data": source_dataTable,
"columnDefs": defs,
"dom": 't<"top"f>rt<"bottom"lpi><"clear">',
});
// WHAT I WANT TO DO:
table.column(0).title.text("new title for the column 0")
?
它在第一行渲染一个 html:
<table id="example" class="row-border hover dataTable no-footer" role="grid" aria-describedby="example_info" style="width: 1140px;">
<thead>
<tr role="row">
<th class="sorting" tabindex="0" aria-controls="example" rowspan="1" colspan="1" aria-label="S&#233;lectionn&#233;: activer pour trier la colonne par ordre croissant" style="width: 94px;">Sélectionné</th>
<th class="sorting" tabindex="0" aria-controls="example" rowspan="1" colspan="1" aria-label="Anglais : activer pour
trier la colonne par ordre croissant" style="width:
62px;">Anglais </th>
</tr>
</thead>
</table>
...
在一个普通的表格中,下面的代码可以工作,但是对于由 jQuery 插件呈现的数据表,它不会:
$('#example tr:eq(0) th:eq(0)').text("Text update by code");
也许有 API 方法或其他 dom 方式?
【问题讨论】:
-
示例应该是英文,而不是法文
标签: javascript jquery datatable datatables