|
312 | 312 | BootstrapTable.prototype.initToolbar = function() { |
313 | 313 | var that = this, |
314 | 314 | html = [], |
315 | | - $pageList, |
316 | 315 | $keepOpen, |
317 | 316 | $search; |
318 | 317 |
|
319 | 318 | this.$toolbar = this.$container.find('.fixed-table-toolbar'); |
320 | 319 |
|
321 | | - if (this.options.pagination) { |
322 | | - html = []; |
323 | | - html.push('<div class="page-list">'); |
324 | | - |
325 | | - var pageNumber = [ |
326 | | - '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">', |
327 | | - '<span class="page-size">', |
328 | | - this.options.pageSize, |
329 | | - '</span>', |
330 | | - ' <span class="caret"></span>', |
331 | | - '</button>', |
332 | | - '<ul class="dropdown-menu" role="menu">']; |
333 | | - |
334 | | - $.each(this.options.pageList, function(i, page) { |
335 | | - var active = page === that.options.pageSize ? ' class="active"' : ''; |
336 | | - pageNumber.push(sprintf('<li%s><a href="javascript:void(0)">%s</a></li>', active, page)); |
337 | | - }); |
338 | | - pageNumber.push('</ul>'); |
339 | | - |
340 | | - html.push(this.options.formatRecordsPerPage(pageNumber.join(''))); |
341 | | - html.push('</div>'); |
342 | | - |
343 | | - this.$toolbar.append(html.join('')); |
344 | | - $pageList = this.$toolbar.find('.page-list a'); |
345 | | - $pageList.off('click').on('click', $.proxy(this.onPageListChange, this)); |
346 | | - } |
347 | | - |
348 | 320 | if (this.options.showColumns) { |
349 | 321 | html = []; |
350 | 322 | html.push('<div class="columns pull-right keep-open">', |
|
421 | 393 | var that = this, |
422 | 394 | html = [], |
423 | 395 | i, from, to, |
| 396 | + $pageList, |
424 | 397 | $first, $pre, |
425 | 398 | $next, $last, |
426 | 399 | $number, |
|
446 | 419 |
|
447 | 420 | html.push( |
448 | 421 | '<div class="pull-left pagination">', |
449 | | - '<div class="pagination-info">', |
| 422 | + '<span class="pagination-info">', |
450 | 423 | this.options.formatShowingRows(this.pageFrom, this.pageTo, this.options.totalRows), |
451 | | - '</div>', |
452 | | - '</div>', |
| 424 | + '</span>'); |
| 425 | + |
| 426 | + html.push('<span class="page-list">'); |
| 427 | + |
| 428 | + var pageNumber = [ |
| 429 | + '<span class="btn-group dropup">', |
| 430 | + '<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">', |
| 431 | + '<span class="page-size">', |
| 432 | + this.options.pageSize, |
| 433 | + '</span>', |
| 434 | + ' <span class="caret"></span>', |
| 435 | + '</button>', |
| 436 | + '<ul class="dropdown-menu" role="menu">']; |
| 437 | + |
| 438 | + $.each(this.options.pageList, function(i, page) { |
| 439 | + var active = page === that.options.pageSize ? ' class="active"' : ''; |
| 440 | + pageNumber.push(sprintf('<li%s><a href="javascript:void(0)">%s</a></li>', active, page)); |
| 441 | + }); |
| 442 | + pageNumber.push('</ul></span>'); |
| 443 | + |
| 444 | + html.push(this.options.formatRecordsPerPage(pageNumber.join(''))); |
| 445 | + html.push('</span>'); |
| 446 | + |
| 447 | + html.push('</div>', |
453 | 448 | '<div class="pull-right">', |
454 | 449 | '<ul class="pagination">', |
455 | 450 | '<li class="page-first"><a href="javascript:void(0)"><<</a></li>', |
|
484 | 479 |
|
485 | 480 | this.$pagination.html(html.join('')); |
486 | 481 |
|
| 482 | + $pageList = this.$pagination.find('.page-list a'); |
487 | 483 | $first = this.$pagination.find('.page-first'); |
488 | 484 | $pre = this.$pagination.find('.page-pre'); |
489 | 485 | $next = this.$pagination.find('.page-next'); |
|
498 | 494 | $next.addClass('disabled'); |
499 | 495 | $last.addClass('disabled'); |
500 | 496 | } |
| 497 | + $pageList.off('click').on('click', $.proxy(this.onPageListChange, this)); |
501 | 498 | $first.off('click').on('click', $.proxy(this.onPageFirst, this)); |
502 | 499 | $pre.off('click').on('click', $.proxy(this.onPagePre, this)); |
503 | 500 | $next.off('click').on('click', $.proxy(this.onPageNext, this)); |
|
0 commit comments