Home > OS >  How set page number 2 of paging in table on start
How set page number 2 of paging in table on start

Time:10-18

I try manually set start page of MudTable by using NavigateTo, but get no result.

protected override async Task OnAfterRenderAsync(bool firstRender){
   await base.OnAfterRenderAsync(firstRender).ConfigureAwait(true);
   if(firstRender){
     table.NavigateTo(2);
    }
}

Reproduction link https://try.mudblazor.com/snippet/GkQbvkvcxNzoxxaq

CodePudding user response:

You can set this directly in your MudTable element :

<MudTable CurrentPage="2">

If you do this remove the lines you added in OnAfterRenderAsync.

You can find this in the API doc.

Also changing this :

table.NavigateTo(2);

To this :

table.CurrentPage = 2;

Seems to be working too, but setting it in the elements seems cleaner.

  • Related