We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to capture the current status of drag and drop card.

Dear Sir/Madam,

After drag and drop kanban card.How to capture and save the status of card.

For example: Drag and drop the card from Open status to close status. Now, want to capture the current status of card and save it and reload it with current status.

Thank you.

1 Reply

BS Buvana Sathasivam Syncfusion Team April 27, 2017 04:58 PM UTC

Hi Ramesh Sadam, 

Thanks for using Syncfusion product. 

We had prepared Kanban sample with CRUD operations using ejDataManager.  DataManager fully supports the CRUD operatons.  In remote CRUD operations, the data should be retrieved from and submitted to a remote data service via HTTP request made by the DataManager.  URL property is used to load data into Kanban and CrudURL property is used to get post action for processing adding/editing/deleting/updating data’s.  You can use below solution for CRUD actions. 

KanbanFeatures.aspx 

<ej:Kanban ID="Kanban" runat="server" KeyField="Status" AllowTitle="true"> 
                <DataManager URL="KanbanFeatures.aspx/GetData"  //To load Kanban          CrudURL="KanbanFeatures.aspx/Crud"     //To perform CRUD operations 
Adaptor="WebMethodAdaptor" />         // Define the adaptor 
           ……. 
</ej:Kanban> 

KanbanFeatures.aspx.cs 

[WebMethod] 
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)] 
        public static object GetData(Syncfusion.JavaScript.DataManager value) // To render all Kanban cards 
        { 
            NORTHWNDEntities1 db = new NORTHWNDEntities1(); 
            IEnumerable Data = db.Tasks.ToList(); 
            int count = Data.AsQueryable().Count(); 
            Syncfusion.JavaScript.DataSources.DataOperations operation = new Syncfusion.JavaScript.DataSources.DataOperations(); 
            Data = operation.Execute(Data, value); 
            return new { result = Data, count = count }; 
        } 
        [WebMethod] 
        [ScriptMethod(ResponseFormat = ResponseFormat.Json)] 
 
        public static object Crud(string key, List<Task> changed, List<Task> added, List<Task> deleted) //Add,Edit,Delete Kanban cards 
        { 
            NORTHWNDEntities1 db = new NORTHWNDEntities1(); 
 
            //Performing insert operation 
            if (added != null && added.Count() > 0) 
            { 
                foreach (var temp in added) 
                { 
                    db.Tasks.Add(temp); 
                } 
            } 
 
            //Performing update operation 
            if (changed != null && changed.Count() > 0) 
            { 
                foreach (var temp in changed)  // Here single updated data was send to temp variable 
                { 
                    Task old = db.Tasks.Where(o => o.Id == temp.Id).SingleOrDefault(); // Get old data from database table 
                    if (old != null) 
                    { 
                        db.Entry(old).CurrentValues.SetValues(temp); // Set updated data into old data 
                    } 
                } 
            } 
 
            //Performing delete operation 
            if (deleted != null && deleted.Count() > 0) 
            { 
                foreach (var temp in deleted) 
                { 
                    db.Tasks.Remove(db.Tasks.Where(o => o.Id == temp.Id).SingleOrDefault()); 
                } 
            } 
            db.SaveChanges(); // Save updated data on database 
            var dataSource = db.Tasks.ToList(); 
            return dataSource; 
        } 





Regards, 
Buvana S. 
 


Loader.
Live Chat Icon For mobile
Up arrow icon