Hi all.
I have been searching around for a tip regarding:
I want to drag an item from a treeview component and to a Dashboard layout.
When the item is dropped i want to catch the item data / args so i can add the correct panel to the dashboard.
Any help would be appriciated.
|
<template>
<ejs-treeview
id="tree"
:allowDragAndDrop="true"
:nodeDragStop="DragStop"
></ejs-treeview>
<ejs-dashboardlayout
ref="DashbordInstance"
:columns="5"
>
</ejs-dashboardlayout>
</template>
<script>
export default {
data() {
return {
};
},
methods: {
DragStop: function (args) {
var panel = [
{
id: this.index.toString() + "_layout",
content:
'<div class="text-align">' +args.draggedNodeData.text + "</div>",
},
];
dashboard.addPanel(panel[0]);
this.index = this.index + 1;
},
},
};
</script>
|
Thank you so much Keerthana. Just what i was looking for.
Some more questions:
Is it possible to hide the stop icon that is shown in the pointer when you are dragging over the dashboard ?
Also i need to detect if the dropstop is in the dashboard or treeview in order to avoid the treeview to be rearranged.
Regards
Geirr
|
<style>
.e-prevent-select {
cursor: auto !important;
}
.e-treeview.e-drag-item .e-icons.e-no-drop::before {
content: "";
}
</style> |
|
<template>
<ejs-treeview
id="tree"
:allowDragAndDrop="true"
:nodeDragStop="DragStop"
></ejs-treeview>
</template>
<script>
export default {
data() {
},
methods: {
DragStop: function (args) {
if (args.target.classList.contains("e-fullrow")) {
args.cancel = true;
} else {
dashboard.addPanel(panel[0]);
}
},
</script>
|
Thank you so much Shalini.
Both proposed solutions works as expected.
Best regards
Geirr