Quantcast
Viewing all articles
Browse latest Browse all 82150

The navigator in the bootstrap extension does not fire 'page' events when a page number is clicked

Here is a patch that worked for me.
Note that I'm not too sure if it's safe to overwrite the iDisplayLength property with paging's iLength.
It didn't seem to explode though.

Somebody else might find it useful.

--- a/public/js/DT_bootstrap.js
+++ b/public/js/DT_bootstrap.js
@@ -84,10 +84,12 @@ $.extend( $.fn.dataTableExt.oPagination, {
                                        sClass = (j==oPaging.iPage+1) ? 'class="active"' : '';
                                        $('<li '+sClass+'><a href="#">'+j+'</a></li>')
                                                .insertBefore( $('li:last', an[i])[0] )
-                                               .bind('click', function (e) {
+                                               .bind('click.DT', {action: 1}, function (e) {
                                                        e.preventDefault();
-                                                       oSettings._iDisplayStart = (parseInt($('a', this).text(),10)-1) * oPaging.iLength
-                                                       fnDraw( oSettings );
+                                                       oSettings._iDisplayLength = oPaging.iLength;
+                                                       if ( oSettings.oApi._fnPageChange(oSettings, (parseInt($('a', this).text(),10)-1)
+                                                               fnDraw( oSettings );
+                                                       }
                                                } );
                                }
 

Viewing all articles
Browse latest Browse all 82150

Trending Articles