Hi Durai,
We have validated your reported query and
prepared the sample based on your requirement. We can achieve your requirement
by using the beforeDrop event of the listbox. Please refer the below
code and sample link.
[index.ts]:
let
listObj1: ListBox = new ListBox({
// Set the scope of the ListBox.
scope: 'combined-list',
// Set the dragAndDropA to the data source.
dataSource: dataA,
// Set allowDragAndDrop as `true`.
allowDragAndDrop: true,
beforeDrop: onDropGroupA,
height: '330px',
// Map the appropriate columns to fields
property.
fields: { text: 'Name' },
});
listObj1.appendTo('#listbox1');
function
onDropGroupA(args: DropEventArgs): void {
if (args.droppedElement.offsetParent.id !==
args.target.offsetParent.id) {
var items = listObj2.getDataList();
for(var i = 0; i < items.length; i++) {
if (items[i] === args.items[0]) {
args.cancel = true;
}
}
}
}
|
Sample link: https://stackblitz.com/edit/hu2feb-7sde4b?file=index.ts
Could you please check the above
sample and get back to us, if you need any further assistance on this.
Regards,
YuvanShankar A