Jqgrid - noOfPages值的计算
Jqgrid - Calculation of noOfPages value
我指的是 Instant jqGrid 一书来设置网格。 noOfPages 属性计算如下。
//Prepare the response
$numberOfPages = ceil( $numberOfRows / $rowsPerPage );
我可以看到对于 rowPerPage=25 的 581 条记录,noOfPages 显示为 23。
System.out.println((int)Math.ceil(581/25));//23
我期望值为 24,最后一页包含记录 [576-581]。所以在这里,我们缺少这 6 条记录。
您似乎使用了 Java,其中两个整数的 ceil 给出了整数。我建议你看看 this theard
恢复可能的解决方案是:
int n = (int) Math.ceil((double) a / b));
int n = a / b + (a % b == 0) ? 0 : 1;
int n = (a + b - 1) / b;
Select 最能满足您的要求
我指的是 Instant jqGrid 一书来设置网格。 noOfPages 属性计算如下。
//Prepare the response
$numberOfPages = ceil( $numberOfRows / $rowsPerPage );
我可以看到对于 rowPerPage=25 的 581 条记录,noOfPages 显示为 23。
System.out.println((int)Math.ceil(581/25));//23
我期望值为 24,最后一页包含记录 [576-581]。所以在这里,我们缺少这 6 条记录。
您似乎使用了 Java,其中两个整数的 ceil 给出了整数。我建议你看看 this theard
恢复可能的解决方案是:
int n = (int) Math.ceil((double) a / b));
int n = a / b + (a % b == 0) ? 0 : 1;
int n = (a + b - 1) / b;
Select 最能满足您的要求