Migrating from 1.9 to 1.10 -- sPaginationType: "bootstrap" seems to be killing me
Migrating from 1.9 to 1.10 -- sPaginationType: "bootstrap" seems to be killing me
rstudner
Posts: 21Questions: 10Answers: 0
So i've gotten the js and css from here:
https://github.com/DataTables/Plugins/tree/master/integration/bootstrap
(the 2 folder -- i'm using bootstrap 2).
It always fails here:
function _fnFeatureHtmlPaginate ( settings ) { var type = settings.sPaginationType, plugin = DataTable.ext.pager[ type ], modern = typeof plugin === 'function', redraw = function( settings ) { _fnDraw( settings ); }, node = $('').addClass( settings.oClasses.sPaging + type )[0], features = settings.aanFeatures; if ( ! modern ) { plugin.fnInit( settings, node, redraw ); }
plugin (DataTable.ext.pager['bootstrap'] is undefined, and thus undefined.fnInit fails
Is there something very obvious i'm missing to set the sPaginationType to bootstrap? (worked easily/trivially in 1.9)
Thanks!
This discussion has been closed.
Answers
Don't set the sPaginationType to
bootstrap
. There isn't abootstrap
paging type as such. Instead you can use any of the options forpagingType
.The paging architecture got an overhaul for 1.10 so that plug-ins (such as Bootstrap) could provide a renderer describing how to display the buttons, but not needing to describe all of the logic for them as well. Splitting this logic like this makes development of integration options much easier!
The Bootstrap renderer is set by the file, so all you should need to do is simply include it.
Allan
so if I use a pagingType: 'full_numbers' and then include the JS and CSS from the repo I should be good to go then?
(it appears to be working, but i'm both new to datatables while trying to do the upgrade in parallel hah)
BTW -- thanks for the insanely fast response.
Yup - you don't need to specify
pagingType
at all if you want to use the default, but you can of course do so if you want to use others such asfull_numbers
.Allan
Last minor question:
with 1.9 and 'bootstrap' it seems my showing 0 of 0 was on the right, and my previous next buttons were on the left.
with 1.10 and the github bootstrap2 integration code.. those things switched sides
Everything works and i'm happy haha.. but I'm having a sneaky suspicion my PM and UX person will balk haha.
(p.s., going to the purchase page now!)
You would just need to add a little bit of CSS if you want to swap the info and paging buttons around. The integration CSS will put the buttons on the right the same as the DataTables default CSS. Just cancel the float and float the info to the right if you need :-)
Allan