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

Workflows not working

This is my view 
@(Html.EJ().Kanban("Subscriptions")
                                   .DataSource(ds => ds.URL(Url.Action("GetData")).Adaptor(AdaptorType.UrlAdaptor))
                                   .IsResponsive(true)
                                   .ClientSideEvents(eve =>
                                   {
                                       eve.CardDrop("changeStatus");
                                   })
                                   .Workflows(workflow =>
                                   {
                                       workflow.Key("RequestToJoin").AllowedTransitions("RequestJoinAccepted,Rejected").Add();
                                       workflow.Key("RequestJoinAccepted").AllowedTransitions("RequestToVerifyContent").Add();
                                       workflow.Key("RequestToVerifyContent").AllowedTransitions("TrialStarted,Started,Rejected").Add();
                                       workflow.Key("TrialStarted").AllowedTransitions("TrialEnd").Add();
                                       workflow.Key("TrialEnd").AllowedTransitions("TrialStarted").Add();
                                       workflow.Key("Started").AllowedTransitions("Ended").Add();
                                       workflow.Key("Ended").AllowedTransitions("Started").Add();
                                   })
                                   .Columns(col =>
                                   {
                                       col.HeaderText("Join Request").Key("RequestToJoin").AllowDrop(false).Add();
                                       col.HeaderText("Join Accepted").Key("RequestJoinAccepted").Add();
                                       col.HeaderText("Join Verify Content").Key("RequestToVerifyContent").Add();
                                       col.HeaderText("Trial Started").Key("TrialStarted").Add();
                                       col.HeaderText("Trial End").Key("TrialEnd").Add();
                                       col.HeaderText("Started").Key("Started").Add();
                                       col.HeaderText("Ended").Key("Ended").Add();
                                       col.HeaderText("Rejected").Key("Rejected").Add();
                                   })
                                  .AllowTitle(true)
                                  .KeyField("Status")
                          .Locale("en-US")
                                  .Fields(field =>
                                  {
                                      field
                                     .Title("Title")
                                     .Content("Content")
                                     .ImageUrl("OrganizationImage")
                                     .PrimaryKey("Id");
                                  })

)

//This is my Action 
 public async Task<JsonResult> GetData(Syncfusion.JavaScript.DataManager value)
        {
            DataResult result = new DataResult();
            DataOperations operation = new DataOperations();
            var subscriptions = db.Subscriptions.IncludeMultiple(a => a.Organization);

            if (subscriptions == null)
            {
                return Json(result, JsonRequestBehavior.AllowGet);
            }
            var list = await subscriptions
                .OrderByDescending(order => order.CreatedDate)
                .ToListAsync();

            var model = new List<KanbanSubscriptionViewModel>();

            foreach (var order in list)
            {
                model.Add(KanbanSubscriptionViewModel.FromSubscription(order));
            }

            result.result = model;
            result.count = model.Count();
            return Json(result, JsonRequestBehavior.AllowGet);
        }


1 Reply

AP Arun Palaniyandi Syncfusion Team September 21, 2017 09:55 AM UTC

 
Hi Musab Adnan Basheer, 

Thanks for contacting Syncfusion support. 

We have validated the shared sample and we can able to reproduce you reported scenario. Hence in order to work with the URL or remote Adptors, at the time of drag and drop the cards we have to add CrudURL for updating the changes in database. So we suggest you to write a function in the controller to do the basic CRUD operations for our Kanban and refer it to CrudURL.  


[View] 

@(Html.EJ().Kanban("Kanban") 
               .DataSource(ds => ds.URL("GetData").CrudURL("Crud").Adaptor(AdaptorType.UrlAdaptor)) 
                   .Columns(col => 
                   { 


[Controller] 

//Edit multiple cards for priority drag and drop 
        public ActionResult Crud(List<Task> changed, List<Task> added, List<Task> deleted) 
        { 
            //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) 
                { 
                    Task old = db.Tasks.Where(o => o.Id == temp.Id).SingleOrDefault(); 
                    if (old != null) 
                    { 
                        db.Entry(old).CurrentValues.SetValues(temp); 
                    } 
                } 
            } 
 
            //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(); 
            var data = db.Tasks.ToList(); 
            return Json(data, JsonRequestBehavior.AllowGet); 
        } 



We have also prepared a simple sample for your reference below. 

Further references, check on this: 

If the provided details does not meet your requirement, please give us with more information that will help us to provide an alternative solution.    
   
Regards,   
Arun P.   



Loader.
Live Chat Icon For mobile
Up arrow icon