diff --git a/Oqtane.Client/Modules/Controls/Pager.razor b/Oqtane.Client/Modules/Controls/Pager.razor index eb6a5ef4..61ffac0a 100644 --- a/Oqtane.Client/Modules/Controls/Pager.razor +++ b/Oqtane.Client/Modules/Controls/Pager.razor @@ -75,19 +75,32 @@ @if (Format == "Grid" && Row != null) { int count = 0; - if (ItemList != null) + int rows = 0; + int cols = 0; + if (ItemList != null) { - count = (int)Math.Ceiling(ItemList.Count() / (decimal)_columns) * _columns; + if (_columns == 0) + { + count = ItemList.Count(); + rows = 1; + cols = count; + } + else + { + count = (int)Math.Ceiling(ItemList.Count() / (decimal)_columns) * _columns; + rows = count / _columns; + cols = _columns; + } }
@if (Header != null) {
@Header
} - @for (int row = 0; row < (count / _columns); row++) + @for (int row = 0; row < rows; row++) {
- @for (int col = 0; col < _columns; col++) + @for (int col = 0; col < cols; col++) { int index = (row * _columns) + col; if (index < ItemList.Count()) @@ -160,7 +173,7 @@ private int _displayPages = 5; private int _startPage = 0; private int _endPage = 0; - private int _columns = 1; + private int _columns = 0; [Parameter] public string Format { get; set; } // Table or Grid