数据表引导分页-仅显示上一个/下一个 [英] datatables bootstrap pagination - only show previous / next
问题描述
通过rweng/jquery-datatables-rails gem将jquery DataTables插件集成到我的rails应用程序中.这很棒.我什至还可以使用bootstrap对其进行样式设置.
Been integrating the jquery DataTables plugin to my rails app, via the rweng/jquery-datatables-rails gem. It's awesome. I even went so far as to style it with bootstrap.
所以,我有引导程序和kaminari用于分页(不确定是否重要).还有一个kaminari-bootstrap宝石.
So, I have bootstrap, and kaminari for pagination (not sure if that matters). There is a kaminari-bootstrap gem as well.
无论如何,DataTables表显示下一个1 2 3 4 5下一个,它只是大块的.我怎么能丢掉这些数字,然后只剩下previoius?
Anyway, the DataTables table shows previous 1 2 3 4 5 next, and it's just chunky. How can I lose the numbers, and just have previoius next?
当前使用以下命令调用数据表:
currently calling datatable with:
jQuery ->
$('#companyBoxList').dataTable
sDom: "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>"
sPaginationType: "bootstrap"
bJQueryUI: true
bProcessing: true
bServerSide: true
sAjaxSource: $('#companyBoxList').data('source')
推荐答案
您有6个选项:
-
numbers
-仅用于页码按钮 -
simple
-仅上一个"和下一个"按钮 -
simple_numbers
-上一个"和下一个"按钮,以及页码 -
full
-第一",上一个",下一个"和最后"按钮 -
full_numbers
-第一",上一个",下一个"和最后一个"按钮以及页码 -
first_last_numbers
-第一"和最后"按钮,以及页码
numbers
- Page number buttons onlysimple
- 'Previous' and 'Next' buttons onlysimple_numbers
- 'Previous' and 'Next' buttons, plus page numbersfull
- 'First', 'Previous', 'Next' and 'Last' buttonsfull_numbers
- 'First', 'Previous', 'Next' and 'Last' buttons, plus page numbersfirst_last_numbers
- 'First' and 'Last' buttons, plus page numbers
numbers
和first_last_numbers
选项是最近添加的.
The numbers
and first_last_numbers
options were recently added.
(源代码: http://www.datatables.net/examples/basic_init/alt_pagination.html )
所以在您的情况下:
// Code jQuery.
$('#companyBoxList').dataTable({
pagingType: "simple"
});
这篇关于数据表引导分页-仅显示上一个/下一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!