如何在Syncfusion日程安排对话框中仅拖动标题栏

huangapple go评论72阅读模式
英文:

how to drag only header in syncfusion scheduler dialog

问题

net core C# syncfusion scheduler.

我使我的日程安排对话框可拖动

function OnPopupOpen(args) {

var dragElement = document.getElementById('schedule_dialog_wrapper');
var draggable = new ej.base.Draggable(dragElement, { clone: false });

但我想要只有在拖动标题栏时才能拖动
但是我的对话框可以在任何地方拖动...像这样...

https://drive.google.com/file/d/1obbc0ti8TgWrG6U8A9igqLtxE0fIKMor/view?usp=sharing

英文:

net core C# syncfusion scheduler.

I made my scheduler's dialog draggable

        function OnPopupOpen(args) {

        var dragElement = document.getElementById('schedule_dialog_wrapper');
        var draggable = new ej.base.Draggable(dragElement, { clone: false });

but I want make drag only I drag the header
but my dialog is draggable anywhere... like this...

https://drive.google.com/file/d/1obbc0ti8TgWrG6U8A9igqLtxE0fIKMor/view?usp=sharing

答案1

得分: 1

你可以在日程安排的弹出窗口打开事件中使用对话框的allowDragging属性,只有拖动对话框标题栏才能进行拖动,而不是整个对话框,如下所示。

allowDragging UG: https://ej2.syncfusion.com/aspnetcore/documentation/dialog/getting-started#draggable

演示: https://ej2.syncfusion.com/aspnetcore/Dialog/Draggable#/fluent

function onPopupOpen(args) 
{
    var dialogInstance = document.querySelector(".e-dialog").ej2_instances[0];
    dialogInstance.allowDragging = true;
}
英文:

You can make drag only when drag the header of dialog instead of full dialog by using the Dialog’s allowDragging property in the Schedule’s popupOpen event, as shown in the below shared snippet.

allowDragging UG: https://ej2.syncfusion.com/aspnetcore/documentation/dialog/getting-started#draggable

Demo: https://ej2.syncfusion.com/aspnetcore/Dialog/Draggable#/fluent

function onPopupOpen(args) 
{
    var dialogInstance = document.querySelector(".e-dialog").ej2_instances[0];
    dialogInstance. allowDragging = true;
}

答案2

得分: 0

不使用位置API,您可以使用刷新方法来实现您的需求,如下所示的代码片段中所示。

function onPopupOpen(args) 
{
    var dialogInstance = document.querySelector(".e-dialog").ej2_instances[0];
    dialogInstance.allowDragging = true;
    dialogInstance.target = '.e-schedule';
    dialogInstance.refresh();
}
英文:

Instead of the position API, you can use the refresh method to achieve your requirement, as shown in the below shared snippet.

 function onPopupOpen(args) 
 {

 var dialogInstance = document.querySelector(".e-dialog").ej2_instances[0];

 dialogInstance.allowDragging = true;   

 dialogInstance.target = '.e-schedule';

 dialogInstance.refresh();

}

huangapple
  • 本文由 发表于 2023年8月9日 12:06:19
  • 转载请务必保留本文链接:https://go.coder-hub.com/76864504-2.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定