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

Disable drap drop in the same column

Hi,

is it possible to desable the possibility of changing the order of the elements in 1 column of the kanban ?

In fact, not allow drag and drop between elements of the same column

Regards



5 Replies

VJ Vinitha Jeyakumar Syncfusion Team April 26, 2023 06:05 AM UTC

Hi Gilles,

Your requirement to disable the drag and drop of cards on the same column in the Kanban board can be achieved by using the dragStart and dragStop event. Please check the code and sample below,

Code snippet:
var kanbanObj = new ej.kanban.Kanban({
  dataSource: data,
  keyField: 'Status',
  columns: [
    { headerText: 'To Do'keyField: 'Open' },
    { headerText: 'In Progress'keyField: 'InProgress' },
    { headerText: 'Testing'keyField: 'Testing' },
    { headerText: 'Done'keyField: 'Close' },
  ],
  cardSettings: {
    contentField: 'Summary',
    headerField: 'Id',
    tagsField: 'Tags',
    grabberField: 'Color',
    footerCssField: 'ClassName',
  },
  dragStop: dragStop,
  dragStart: dragStart,
});
//Render initialized Kanban control
kanbanObj.appendTo('#Kanban');
var status;
function dragStop(args) {
  if (this.status == args.data[0].Status) {
    args.cancel = true;
  }
}
function dragStart(args) {
  this.status = args.data[0].Status;
}




Regards,
Vinitha


GI Gilles April 26, 2023 01:46 PM UTC

Thanks !

But

I would like not to be able to choose the location in the column but  just move an element from one column to another and putting it in the first position in the target column


Regards



IS Indrajith Srinivasan Syncfusion Team April 27, 2023 10:40 AM UTC

Gilles, you can by default move the dropped element to the first positionin the target column by just setting the dropIndex in the dragStop event of the kanban component. Check the below shared code block and sample for reference.


 

function dragStop(args) { 

  args.dropIndex = 0;

  ...

}

 


Sample: https://stackblitz.com/edit/c5fyle-frjnsx?file=index.html,index.js



GI Gilles April 27, 2023 02:34 PM UTC

Thanks !

For this to be perfect, the shadow that delimits the drop should not be on a box but be on the whole column. Is it possible ?



VJ Vinitha Jeyakumar Syncfusion Team May 2, 2023 12:03 PM UTC

Hi Gilles,


We would like to inform you that the cloned shadow element generated when a card is dropped into a Kanban column is intended to maintain its position during drag and drop operations. Therefore, it is not possible to create a cloned shadow element for the entire column

Please let us know if you have any concerns.

Regards,
Vinitha

Loader.
Live Chat Icon For mobile
Up arrow icon