diff --git a/README.md b/README.md index 1cc094e..4850fdb 100644 --- a/README.md +++ b/README.md @@ -15,38 +15,38 @@ This is a very early project. However, it does function and is very much usable. - Usage ``` html Sortable List - - @foreach (var item in @MyGroup.Sortable.GetRaw()) - { - @item.Data - } - + + + +@resultsList ``` ``` c# @code { - SortableGroup MyGroup; - List items { get; set; } = new List { "T1", "T2", "T3" }; + SortGroup MyGroup; + List items { get; set; } = new List + { + new Items("T1"), + new Items("T2"), + new Items("T3"), + }; List resultsList { get; set; } = new List(); - - protected override Task OnInitializedAsync() + + public async Task OnSort(SortableEvent e) { - resultsList = items; - return base.OnInitializedAsync(); + ResultsList = await e.Sender.GetOrderListAsync("Order"); } - - protected override async Task OnAfterRenderAsync(bool firstRender) + + public class Items { - if (firstRender) - { - MyGroup.Sortable.SetData(items); - await MyGroup.Sortable.CreateAsync(MyGroup.Id, new SortableJsOptions - { - Group = "test", - Animation = 100, - }); + public int Order { get; set; } = 0; + public string Text { get; set; } - StateHasChanged(); + public Items(string text) + { + Text = text; } } }