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.
Unfortunately, activation email could not send to your email. Please try again.

How to get target ID?

Thread ID:

Created:

Updated:

Platform:

Replies:

132526 Sep 6,2017 04:46 PM Sep 11,2017 07:53 AM ASP.NET MVC 4
loading
Tags: Kanban
Sam Tran
Asked On September 6, 2017 04:46 PM

Hi,

After I drag and drop a card from one column to another, how do I get the ID of the column and the id of the swim lane the card was dropped into?

Thanks!

Arun Palaniyandi [Syncfusion]
Replied On September 7, 2017 06:57 AM

Hi Sam Tran , 

Thanks for contacting Syncfusion support. 

We can able to achieve your requirement by using the cardDrop event of the kanban. Bind this event and from the argument draggedElement, we can able get the column and swimlane details of the card was dropped to.  Please find the below code snippets. 
 
 
   cardDrop: function (args) { 
 
            var obj = $("#Kanban").data("ejKanban"); 
            if(!ej.isNullOrUndefined(obj.model.fields.swimlaneKey)) 
                alert("Dropped Swimlane Id: " + args.draggedElement.parents(".e-columnrow").prev().attr("id")); 
            alert("Dropped Column mapping key: " + args.draggedElement.parent().attr("data-ej-mappingkey")); 
        } 
 
 
 
 


If the shared details and sample doesn’t meet your requirement, please give us more information to help us to provide an alternative solution.     

Regards,
Arun P.  


Sam Tran
Replied On September 8, 2017 02:22 PM

Thank you for helping me with this!

I'm using MVC and for some reason

     args.draggedElement.parent().attr("data-ej-mappingkey")

returns as undefined.

I know the columns are getting the correct ID's because the cards are placed in the correct column.

But when I drag the card to a different column,  args.draggedElement.parent() does exist as object, but the .attr("data-ej-mappingkey")  part is undefined.

Again, if the key was not there, how come the card records were placed in the correct column?

I will attached the partial view...maybe you can see what I did wrong.


Thanks again!


Attachment: ForSyncFusionSupport_f00e9202.rar

Sam Tran
Replied On September 8, 2017 02:42 PM

I got it.

Instead of:

args.draggedElement.parent().attr("data-ej-mappingkey")); 

I used:

args.draggedElement.parent().attr("ej-mappingkey")); 

and that gets me the correct column id...why would the attribute be different??

Your code works fine in your example, and I put your code in the sample SyncFusion project and it also works...what is it about my project that would make the attribute different?

Thanks!!!


Arun Palaniyandi [Syncfusion]
Replied On September 11, 2017 07:53 AM

 
Hi Sam Tran,    
  
Thanks for your update.   
  
We regret the inconvenience caused. Actually, we have done HTML5 compliance with our web components. When we validate, we found some issues in our Kanban component and then analyzed those issues completely with HTML5 support and fixed. Hence the attribute structure had been changed and these changes are effective from our Volume 3, 2017 main release for most of all our components. So, if you are using the version before Volume 3 (15.3.0.26), you can use attr("ej-mappingkey")) to take the values. But if you are using above Volume 3, you must use the attr("data-ej-mappingkey")) to take attributes.   


 
 
Regards,   
Arun P. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;