我很难使用Angular PrimeNG进行拖放功能。我在p-tree中有TreeNode类型的字典元素列表。我试图将节点从p-tree拖到p-autocomplete,这是一个文本框。当我在它们之间进行拖放时,即使没有触发search($ event)中的日志信息,也没有发生任何事情。通过谷歌搜索并在Github上查看PrimeNG的源代码,我注意到p树仅允许在p树之间或内部进行拖放行为。我无法直接将TreeNode拖放到p-tree之外。有什么棘手的方法可以解决吗?
PrimeNG github:https://github.com/primefaces/primeng/blob/master/src/app/components/tree/tree.ts
PrimeNG文档: https://www.primefaces.org/primeng/#/tree
<p-tree
[value]="dataDictionary"
selectionMode="single"
[filter]="true"
draggableNodes="true"
(onNodeSelect)="nodeSelect($event)"
droppableNodes="true"
[loading]="loading"
[(selection)]="selectedElement"
(onDragStart)="dragStart(ddtree)"
pDraggable="dd"
(onNodeDrop)="drop($event)"
></p-tree>
<p-autoComplete
[(ngModel)]="source"
[suggestions]="Source"
[minLength]="1"
(completeMethod)="search($event)"
field="business_name"
placeholder="Enter column"
pDroppable="dd"
(onDrop)="drop($event)"
id="inputText"
></p-autoComplete>
search(event){
console.log("Start searching",event);
...
...
}
export interface TreeNode {
label?: string;
data?: any;
icon?: any;
expandedIcon?: any;
collapsedIcon?: any;
children?: TreeNode[];
leaf?: boolean;
expanded?: boolean;
type?: string;
parent?: TreeNode;
partialSelected?: boolean;
styleClass?: string;
draggable?: boolean;
droppable?: boolean;
selectable?: boolean;
key?: string;
}