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

rstudnerrstudner 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!

Answers

  • allanallan Posts: 61,451Questions: 1Answers: 10,055 Site admin
    edited February 2015

    Don't set the sPaginationType to bootstrap. There isn't a bootstrap paging type as such. Instead you can use any of the options for pagingType.

    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

  • rstudnerrstudner Posts: 21Questions: 10Answers: 0

    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.

  • allanallan Posts: 61,451Questions: 1Answers: 10,055 Site admin

    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 as full_numbers.

    Allan

  • rstudnerrstudner Posts: 21Questions: 10Answers: 0

    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!)

  • allanallan Posts: 61,451Questions: 1Answers: 10,055 Site admin

    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

This discussion has been closed.