mleibman / SlickGrid

A lightning fast JavaScript grid/spreadsheet
http://wiki.github.com/mleibman/SlickGrid
MIT License
6.82k stars 1.98k forks source link

Redundant code in slick.pager.js #1045

Open Stephan-C opened 9 years ago

Stephan-C commented 9 years ago

Hello

I was just changing the status text of the pager that gets displayed. Then I saw this code: https://github.com/mleibman/SlickGrid/blob/master/controls/slick.pager.js Line 135 - 146

if (pagingInfo.pageSize == 0) {
var totalRowsCount = dataView.getItems().length;
var visibleRowsCount = pagingInfo.totalRows;
if (visibleRowsCount < totalRowsCount) {
$status.text("Showing " + visibleRowsCount + " of " + totalRowsCount + " rows");
} else {
$status.text("Showing all " + totalRowsCount + " rows");
}
$status.text("Showing all " + pagingInfo.totalRows + " rows");
} else {
$status.text("Showing page " + (pagingInfo.pageNum + 1) + " of " + pagingInfo.totalPages);
}

The $status.text("Showing all " + pagingInfo.totalRows + " rows"); just overwrites the if above it.

What should this code be.

Thanks

6pac commented 9 years ago

This has been integrated into my 'alternative master'. See https://github.com/mleibman/SlickGrid/issues/1055