GithubHelp home page GithubHelp logo

kinetiq / blazorsortablejs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jbomhold3/blazorsortablejs

0.0 2.0 0.0 2.41 MB

BlazorSortable JS

Home Page: https://blazorsortablejsdemo.azurewebsites.net/

HTML 16.51% C# 43.03% CSS 14.34% TypeScript 9.51% JavaScript 16.61%

blazorsortablejs's Introduction

BlazorSortableJS

BlazorSortableJS is a Blazor Wrapper over JavaScript Sortable lib.

Sortable is a JavaScript library for reorderable drag-and-drop lists.

This is a very early project. However, it does function and is very much usable. The user experience will get better over.

NuGet Pre Release

  • _host.cshtml
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
<script src="_content/BlazorSortableJs/js/BlazorSortableJs.js"></script>
  • Usage
Sortable List
<SortableGroup Class="list-group" TItem="string" @ref="MyGroup">
    @foreach (var item in @MyGroup.Sortable.GetRaw())
    {
        <SortableItem Class="list-group-item" Item="item" TItem="string">@item.Data</SortableItem>
    }
</SortableGroup>
@code
{
    SortableGroup<string> MyGroup;
    List<string> items { get; set; } = new List<string> { "T1", "T2", "T3" };
    List<string> resultsList { get; set; } = new List<string>();

    protected override Task OnInitializedAsync()
    {
        resultsList = items;
        return base.OnInitializedAsync();
    }

    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
        {
            MyGroup.Sortable.SetData(items);
            await MyGroup.Sortable.CreateAsync(MyGroup.Id, new SortableJsOptions
            {
                Group = "test",
                Animation = 100,
            });         

            StateHasChanged();
        }
    }
}

Change Log

https://github.com/jbomhold3/BlazorSortableJS/releases

blazorsortablejs's People

Contributors

ctrl-alt-d avatar dependabot[bot] avatar jbomhold3 avatar kinetiq avatar veithbuergerhoff avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.