I am customizing the pagination info and it worked fine when there is some data in jquery datatable. But the same is not working when table is empty.
我正在自定义分页信息,当jquery数据表中有一些数据时它工作正常。但是当表空时,同样不起作用。
Customized the sInfo from "Showing _START_to_END_of_TOTAL _entries" to "Showing_START_to_END_of_TOTAL_".
自定义sInfo从“显示_START_to_END_of_TOTAL _entries”到“Showing_START_to_END_of_TOTAL_”。
Sample code is here. http://jsfiddle.net/inDiscover/d1fg8mrt/
示例代码在这里。 http://jsfiddle.net/inDiscover/d1fg8mrt/
HTML
<table id="myTable">
<thead>
<tr>
<th>Header</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
JS Code
$(document).ready(function(){
var oDTOptions = {};
oDTOptions = {"oLanguage": {"sInfo": "Showing _START_ to _END_ of _TOTAL_"}};
$('#myTable').dataTable(oDTOptions);
});
1 个解决方案
#1
2
The info text for empty records is stored in sInfoEmpty
. So
空记录的信息文本存储在sInfoEmpty中。所以
"oLanguage": {
"sInfoEmpty": "Showing 0 to 0 of 0",
"sInfo": "Showing _START_ to _END_ of _TOTAL_"
}
_START_
, _END_
and _TOTAL_
is not translated when using sInfoEmpty
, it would not make sense since those values always is 0.
使用sInfoEmpty时,_START _,_ END_和_TOTAL_未翻译,因为这些值始终为0,所以没有意义。
updated fiddle -> http://jsfiddle.net/d1fg8mrt/1/
更新小提琴 - > http://jsfiddle.net/d1fg8mrt/1/
The above answer is targeting dataTables 1.7.5 OP is using, but works with all dataTables 1.9.x and 1.10.x versions as well. If anyone wants to use the none-hungarian naming convention in 1.10.x the equivalence is :
上面的答案是针对数据表1.7.5 OP正在使用,但也适用于所有dataTables 1.9.x和1.10.x版本。如果有人想在1.10.x中使用非匈牙利语命名约定,则等价是:
language: {
infoEmpty: "Showing 0 to 0 of 0",
info: "Showing _START_ to _END_ of _TOTAL_"
}
#1
2
The info text for empty records is stored in sInfoEmpty
. So
空记录的信息文本存储在sInfoEmpty中。所以
"oLanguage": {
"sInfoEmpty": "Showing 0 to 0 of 0",
"sInfo": "Showing _START_ to _END_ of _TOTAL_"
}
_START_
, _END_
and _TOTAL_
is not translated when using sInfoEmpty
, it would not make sense since those values always is 0.
使用sInfoEmpty时,_START _,_ END_和_TOTAL_未翻译,因为这些值始终为0,所以没有意义。
updated fiddle -> http://jsfiddle.net/d1fg8mrt/1/
更新小提琴 - > http://jsfiddle.net/d1fg8mrt/1/
The above answer is targeting dataTables 1.7.5 OP is using, but works with all dataTables 1.9.x and 1.10.x versions as well. If anyone wants to use the none-hungarian naming convention in 1.10.x the equivalence is :
上面的答案是针对数据表1.7.5 OP正在使用,但也适用于所有dataTables 1.9.x和1.10.x版本。如果有人想在1.10.x中使用非匈牙利语命名约定,则等价是:
language: {
infoEmpty: "Showing 0 to 0 of 0",
info: "Showing _START_ to _END_ of _TOTAL_"
}