英文:
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 });
但是我只想在拖动标题栏时才能拖动对话框
但是我的对话框可以在任何地方拖动...就像这样...
英文:
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
您可以在日程安排的弹出窗口打开事件(popupOpen)中,通过使用对话框(Dialog)的allowDragging属性,仅在拖动对话框标题时进行拖动,而不是整个对话框。以下是示例代码:
function onPopupOpen(args) {
var dialogInstance = document.querySelector(".e-dialog").ej2_instances[0];
dialogInstance.allowDragging = true;
}
您可以在allowDragging UG中了解更多关于allowDragging属性的信息。
您可以在Demo中查看示例演示。
英文:
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
你可以使用refresh方法来实现你的需求,而不是使用position API,如下所示的代码片段:
function onPopupOpen(args) {
var dialogInstance = document.querySelector(".e-dialog").ej2_instances[0];
dialogInstance.allowDragging = true;
dialogInstance.target = '.e-schedule';
dialogInstance.refresh();
}
请注意,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();
}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论