How to extend PagingType options

How to extend PagingType options

kmd1970kmd1970 Posts: 36Questions: 8Answers: 1
edited September 2015 in Free community support

I am trying to extend the Datatables pagingType: options to include my custom "full_numbers_icons" option.

(this will be used to trigger showing [< first] [<< previous] [next >>] [last >] arrow icons in paging toolbar buttons.

This code is used to set defaults in Datatables.bootstrap.js :

$.extend( true, DataTable.defaults, {
    dom:
        "<'ui two column grid'<'left aligned column'l><'right aligned column'f>>" +
        "<'ui grid'<'column'tr>>" +
        "<'ui two column stackable grid'<'left aligned four wide column'i><'right aligned twelve wide column'p>>",
    renderer: 'semantic'
} );

Here is my attempt to add to the pager types, however I keep getting errors for function TypeError: _numbers is not a function :

$.extend( DataTable.ext.pager, {
        full_numbers_icons: function ( page, pages ) {
            
            return [ 'first', 'previous', _numbers(page, pages), 'next', 'last' ];
        }
});

Answers

  • kmd1970kmd1970 Posts: 36Questions: 8Answers: 1

    Solution found?

    Simply copy full_numbers function(), since they are essentially the same.

    $.extend( DataTable.ext.pager, {
            full_numbers_icons: DataTable.ext.pager.full_numbers
    });
    
This discussion has been closed.