How is CRUD performed using the Kanban for remote data?

Good day

I am trying to understand the Kanban visualization so I downloaded the example provided in the forum but it doesn't work.
The request payloads for updating cards and moving cards (action says batch) are completely different. See attached. The code works for moving cards but the Kanban does not refresh, the spinner keeps spinning.

I actually want to use an API as the data source so I am trying to determine the data signatures for each task.. 

Thank you



  1. {value: {Id: 2, Status: "InProgress", Assignee: "Andrew Fuller",…}, action: "update", keyColumn: "Id",…}
    1. action"update"
    2. key2
    3. keyColumn"Id"
    4. tablenull
  1. {,…}
    1. action"batch"
    2. added[]
    3. deleted[]

Attachment: Kanban_move_a913eb00.zip

4 Replies 1 reply marked as answer

RW Ronald Walcott October 13, 2020 04:39 AM UTC

Good day

I have added 
    <PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.8" />

NewtonsoftJson and changed Startup.cs

            services.AddControllersWithViews().AddNewtonsoftJson(options =>
            {
                options.SerializerSettings.ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver();
            });

and also changed

    public class EditParams
    {
        public string key { get; set; }
        public string action { get; set; }
        public string keyColumn { get; set; }
        public string table { get; set; }

        public List<KanbanCard> added { get; set; }
        public List<KanbanCard> changed { get; set; }
        public List<KanbanCard> deleted { get; set; }
        public KanbanCard value { get; set; }
    }

 which was in the example.
The EditParams class is now showing the results from the request payload and no longer showing null. I still don't understand why there is an added, changed and deleted list and a single value Kanban card class if every change in the Kanban performs some type of data request update..


RV Ravikumar Venkatesan Syncfusion Team October 13, 2020 04:18 PM UTC

Hi Ronald, 

Greetings from Syncfusion support. 

We have validated your reported query “Kanban does not refresh, the spinner keeps spinning” at our end. You can resolve the reported problem in the sample by adding the below-highlighted code in the sample. 

[HomeController.cs] 
        public List<KanbanCard> UpdateCard([FromBody]EditParams param) 
        { 
            // this block of code will execute while inserting the new cards 
            if (param.action == "insert" || (param.action == "batch" && param.added.Count > 0)) 
            { 
                var value = (param.action == "insert") ? param.value : param.added[0]; 
                int intMax = _context.KanbanCards.ToList().Count > 0 ? _context.KanbanCards.ToList().Max(p => p.Id) : 1; 
                KanbanCard card = new KanbanCard() 
                { 
                    Assignee = value.Assignee, 
                    RankId = value.RankId, 
                    Status = value.Status, 
                    Summary = value.Summary 
                }; 
                _context.KanbanCards.Add(card); 
                _context.SaveChanges(); 
            } 
            // this block of code will execute while updating the existing cards 
            if (param.action == "update" || (param.action == "batch" && param.changed.Count > 0)) 
            { 
                KanbanCard value = (param.action == "update") ? param.value : param.changed[0]; 
                IQueryable<KanbanCard> filterData = _context.KanbanCards.Where(c => c.Id == Convert.ToInt32(value.Id)); 
                if (filterData.Count() > 0) 
                { 
                    KanbanCard card = _context.KanbanCards.Single(A => A.Id == Convert.ToInt32(value.Id)); 
                    card.Summary = value.Summary; 
                    card.Status = value.Status; 
                    card.RankId = value.RankId; 
                    card.Assignee = value.Assignee; 
                } 
                _context.SaveChanges(); 
            } 
            // this block of code will execute while deleting the existing cards 
            if (param.action == "remove" || (param.action == "batch" && param.deleted.Count > 0)) 
            { 
                if (param.action == "remove") 
                { 
                    int key = Convert.ToInt32(param.key); 
                    KanbanCard card = _context.KanbanCards.Where(c => c.Id == key).FirstOrDefault(); 
                    if (card != null) 
                    { 
                        _context.KanbanCards.Remove(card); 
                    } 
                } 
                else 
                { 
                    foreach (KanbanCard cards in param.deleted) 
                    { 
                        KanbanCard card = _context.KanbanCards.Where(c => c.Id == cards.Id).FirstOrDefault(); 
                        if (cards != null) 
                        { 
                            _context.KanbanCards.Remove(card); 
                        } 
                    } 
                } 
                _context.SaveChanges(); 
            } 
            return _context.KanbanCards.ToList(); 
        } 
    } 

Please let us know if you need any further assistance. 

Regards, 
Ravikumar Venkatesan 


Marked as answer

RW Ronald Walcott October 15, 2020 05:57 AM UTC

Thank you


NR Nevitha Ravi Syncfusion Team October 15, 2020 03:30 PM UTC

Hi Ronald, 
  
You are most welcome. Please get back to us if you need any further assistance.

Regards, 
Nevitha 


Loader.
Up arrow icon