enhance Pager to support pure responsive Grid format (Columns = 0)
This commit is contained in:
		| @ -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; | ||||
| 			} | ||||
|         } | ||||
|         <div class="@Class"> | ||||
|             @if (Header != null) | ||||
|             { | ||||
|                 <div class="row"><div class="col">@Header</div></div> | ||||
|             } | ||||
|             @for (int row = 0; row < (count / _columns); row++) | ||||
|             @for (int row = 0; row < rows; row++) | ||||
|             { | ||||
|                 <div class="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 | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Shaun Walker
					Shaun Walker