How can I set @pagination.ItemsPerPage to 'All'? in QuickGrid?

609 Views Asked by At

I would like to enter "All" as an <option> that gets bound to @pagination.ItemsPerPage" in the MS QuickGrid.

The setting when selected is ignore.

2

There are 2 best solutions below

0
On

It seems the Pagination type has been replaced with PaginationState. I found a solution...

<select @bind="@pagination.ItemsPerPage"> 
     <option>5</option> 
     <option>10</option> 
     <option>15</option> 
     <option>20</option> 
     <option>25</option> 
     <option value="@pagination.TotalItemCount">All</option>
</select>
1
On

Had then an issue where QuickGrid generated a number of blank lines when the data source was filtered. Had to comment out some lines in the QuickGrid code...

private void RenderNonVirtualizedRows(RenderTreeBuilder __builder)
{
    var initialRowIndex = 2; // aria-rowindex is 1-based, plus the first row is the header
    var rowIndex = initialRowIndex; 
    foreach (var item in _currentNonVirtualizedViewItems)
    {
        RenderRow(__builder, rowIndex++, item);
    }

    // When pagination is enabled, by default ensure we render the exact number of expected rows per page,
    // even if there aren't enough data items. This avoids the layout jumping on the last page.
    // Consider making this optional.
    //if (Pagination is not null)
    //{
    //    while (rowIndex++ < initialRowIndex + Pagination.ItemsPerPage)
    //    {
    //        <tr></tr>
    //    }
    //}
}

Works now! :-)