Query about drag and drop in javascript FileManger control

Is it possible to drag the FileManager item and drop that item to another control (list box) ?


1 Reply

IL Indhumathy Loganathan Syncfusion Team November 10, 2021 01:22 PM UTC

Hi Durai, 
 
Greetings from Syncfusion support. 
 
We have validated your requirement in File Manager component. Yes, you can drag a file from File Manager component and drop it inside the external ListBox or any other component. For your reference, we have prepared a sample to achieve your requirement. Please check the below code snippet. 
 
var fileObject = new ej.filemanager.FileManager({ 
  ajaxSettings: { 
    ... 
  }, 
  allowDragAndDrop: true, 
  success: success, 
  fileDragStop: fileDragStop, 
}); 
fileObject.appendTo('#filemanager'); 
function success() { 
  fileObject.largeiconsviewModule.dragObj.dragArea = '.sample-container'; 
} 
function fileDragStop(args) { 
  if (args.target.closest('.e-listbox-wrapper') != null) { 
    listObj.addItems([ 
      { 
        text: args.fileDetails[0].name, 
      }, 
    ]); 
  } 
} 
 
In the sample code, we have set the dragArea as sample-container, which is the complete div container class. So you can drag the files anywhere inside the container. By using fileDragStop event, we have added the items in ListBox component using addItems method. Please find the sample from below link. 
 
 
Please let us know if you need any further assistance. 
 
Regards, 
Indhumathy L 


Loader.
Up arrow icon