Open jrd6dk opened 3 years ago
@jrd6dk I tested with your code example in the MatBlazor demo and I could not recreate your issue. Seemed to work fine for me with the latest code from Git Master. I did test with the BlazorFiddle and that did not work so maybe there is something in the latest code that needs to be released. I suggest you build your own version of MatBlazor or wait until the next release.
' MatTable Items="@cars" class="mat-elevation-z5" @bind-CurrentPage="Page">
<MatTableRow>
<td>@context.Name</td>
<td>@string.Format("${0:f2}", @context.Price)</td>
<td>@context.Horsepower</td>
</MatTableRow>
</MatTable>
<MatTextField @bind-Value="Page" Label="Go To Page" />
@code
{
public int Page = 2;
public class Car
{
public string Name { get; set; }
public double Price { get; set; }
public int Horsepower { get; set; }
public Car(string name, double price, int horsepower)
{
Name = name;
Price = price;
Horsepower = horsepower;
}
}
Car[] cars = new[]
{
new Car("Volkswagen Golf", 10000, 220),
new Car("Volkswagen Passat", 11000, 240),
new Car("Volkswagen Polo", 12000, 110),
new Car("Ford Focus", 13000, 200),
new Car("Ford Fiesta", 14000, 160),
new Car("Ford Fusion", 15000, 260),
new Car("Ford Mondeo", 16000, 120),
new Car("Ford Fiesta", 14000, 160),
new Car("Ford Fusion", 15000, 260),
new Car("Ford Mondeo", 16000, 120),
new Car("Volkswagen Golf", 10000, 220),
new Car("Volkswagen Passat", 11000, 240),
new Car("Volkswagen Polo", 12000, 110),
new Car("Ford Focus", 13000, 200),
new Car("Ford Fiesta", 14000, 160),
new Car("Ford Fusion", 15000, 260),
new Car("Ford Mondeo", 16000, 120),
new Car("Ford Fiesta", 14000, 160),
new Car("Ford Fusion", 15000, 260),
new Car("Ford Mondeo", 16000, 120),
};
}`
Describe the question Is there a way to Make MatTable go to a specific page. Setting CurrentPage does not seem to do it.
Blazorfiddle link https://blazorfiddle.com/s/8hra9leu
Expected behavior When setting CurrentPage the page should change. Alternative to NavigateToPage method could be public allowing the user to change page.