Skip to content

Simpler Table Sort example that works #282

@bobtnt

Description

@bobtnt

Is your feature request related to a problem? Please describe.

I saw the sample code for Table with Sorting but the c# code is too complex for me (the razor code is fine). I tried creating something much simpler. I was able to get the data and the sort button to show up. When the sort button is clicked, it toggles between "Asc", "Desc", "Unset" which is correct but the rows in the table don't get sorted at all. What am I missing? Thanks in advance.

Describe the solution you'd like

Is it possible to provide simpler example for Table with Sort?

Additional context

Here's what I tried:

========================= Razor ==================

@page "/"

<Table TItem="Lot" Items="simpleList">
    <TableColumns>
        <TableColumn @bind-Field="@context.lotnum" Sortable="true" />
    </TableColumns>
</Table>

======================== c# ======================


using BootstrapBlazor.Components;
using Microsoft.AspNetCore.Components;

namespace Testing.Shared.Pages
{
  public partial class Index : ComponentBase
    {

     public class Lot
        {
            public string lotnum { get; set; }

            public Lot()
            {
            }

            public Lot(string lotnum)
            {
                this.lotnum = lotnum;
            }
        }

    public List<Lot> simpleList { get; set; } = new List<Lot>() { new Lot("a"), new Lot ("b")};

    }
}

image

image

Metadata

Metadata

Assignees

Labels

questionQuestion that needs to be answered

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions