Context
We're using Scheduler component and a custom list of items. We're also using the Draggable component to let the items to be dropped into the Scheduler component. You can find the layout of the implementation in the attachment.
The configuration of the items is the following:
$(element)
.find(`.${NS}customer-list__draggable`)
.kendoDraggable({
hint: () => {
var draggableElem = $(`
<span class="ui-draggable ${NS}customer-list__dragging">
${scope.customer.name} <br>
</span>
`);
draggableElem.css({
borderLeft: `3px solid ${scope.customer.displayColor}`
});
return draggableElem;
},
dragstart: event => {
// prevent dragging on agenda view
if ($rootScope.scheduler.viewName() === "agenda") {
event.preventDefault();
}
},
autoScroll: false,
containment: "window",
cursorOffset: { right: 0, top: 0, left: 0, bottom: 0 },
distance: 50,
group: "schedulerCustomerGroup"
});
The configuration of the Drop are is the following:
scheduler.view().table.kendoDropTargetArea({
group: 'schedulerCustomerGroup',
filter: '.k-scheduler-table td, .k-scheduler-header-all-day td, .k-event',
dragenter: (e) => {
var offset = $(e.dropTarget).offset(),
slot = scheduler.slotByPosition(offset.left, offset.top);
$(slot.element).css('background', '#bce8f1');
},
dragleave: (e) => {
var offset = $(e.dropTarget).offset(),
slot = scheduler.slotByPosition(offset.left, offset.top);
$(slot.element).css('background', '');
},
drop: (event) => {
var offset = $(event.dropTarget).offset(),
slot = scheduler.slotByPosition(offset.left, offset.top),
dragElem = event.draggable.element[0],
customer = _.find($rootScope.customers, {id: $(dragElem).data('customerId')});
$(slot.element).css('background', '');
scheduler.addEvent({
title: customer.name,
start: slot.startDate,
end: slot.endDate,
description: '',
customerId: customer.id,
streetAddr: customer.streetAddr,
city: customer.city,
state: customer.state,
country: customer.country,
zip: customer.zip,
phone: customer.phone,
lat: customer.lat,
long: customer.long,
accountId: customer.accountId,
contactId: customer.d_tx_uid,
isAllDay: slot.isDaySlot,
});
}
});
You can notice the group setting is the same in both configurations: schedulerCustomerGroup.
The filter configured in the kendoDropTargetArea is the following:
As you can see, the filter include all the cells in the Scheduler component.
Problem
The problem I'm having is when using the Work Week, and resizing the browser to an specific dimension, some cells are not being detected as drop area.
As you can see, I cannot drop the item in Wed 2/21.
A workaround is to resize the browser, but that's not a final solution I'm expecting to have.
Hi,
I was developing using kendo UI TreeList, however I found an issue when I drop a row from 1 parent to another, the source was not reparenting to the correct parent. Instead if was set to wrong position (as for my case it become a parent itself).
Step to reproduce:
Open this url https://dojo.telerik.com/UCUXaloN
Drag "Sprint planning (2012-2728)" and drop it to "Kick off" as per image below
After the drop the e.position should be "over" and I expect the row will appear inside "Kick Off" node and not as a parent itself. In the drop event after the "over" I will have my own logic to perform certain task.
Help is needed as I try with different and still not able to position it correctly.
Hello all,
I have two issues adding the upload widget inside the grid.
1. I am trying to create a grid with an upload widget as one of its columns and make user be able to upload a file using drag&drop functionality.
The problem is that I could select file by the select button but drag&drop functionality is not working.
Below is my source data.
html:
<div id="grid1wrapper" class="row">
<div class="col-md-12">
<div id="grid1" kendo-grid="grid1" k-options="gridOptions" k-data-source="dataSource"></div>
</div>
</div>
javascript:
$scope.gridOptions = {
height: 500,
editable: true,
resizable: true,
navigatable: true,
columns: [
{
field: 'filename',
title: 'File Name'
},
{
title: 'File',
field: 'file',
attributes: { "class": 'text-center' },
editor: $scope.fileUploader,
width: 200
},
{
command: "destroy",
title: " ",
width: 40
}]
};
$scope.fileUploader = function(container, options) {
const name = options.field;
$('<input type="file" name="'+ name +'"/>')
.appendTo(container)
.kendoUpload({
multiple: false,
localization: {
dropFilesHere: "DropFilesHere"
}
});
};
2. After upload file and click another field to fill out the data, the uploaded file disappears and I cannot save file with save button.
Any idea?
Thank you.
I was able to reproduce the functionality on the following demo:
https://demos.telerik.com/kendo-ui/cards/drag-and-drop
I would like to be able to apply this to a dashboard screen where the user is able to move the widgets/cards around. What can I use to save as a preference for the order of the cards/widgets? Is there an attribute or parameter that tells the Kendo List where it should be in the list? That way the next time they come to the page the cards will be in the order they last saved them in.
Hello,
I'm my angular app I'm trying to achieve drag and drop from treeview to grid.
I have on the sidebar a list of items in a treeview and what to drag them to the grid. Even if this feature is not provided out-of-the-box, I could implement it if I had on the drop event, the id of the dragged item and the position where it is dropped.
Is this possible?
Thanks in advance
Please see the image marked. Looking for the same functionality at the parent element.
Hi ,
Attached is a version of JavaScript we use to bind dynamic data to kendo grid with dynamic columns and server side grouping enabled. (As seen in the logic, we use a group column to group and ungroup column to ungroup on a field.)
I am looking forward for implementing the below. Please provide a sample version of the modified js file and/or links to appropriate client side events that can support these in a logical order.
1. How to disable the default behavior of drag and drop on grouping , but still show the grouping grey bar above the grid?
I tried the below but it is not working(can't find the equivalent draggable event for group)
https://docs.telerik.com/kendo-ui/controls/interactivity/draganddrop/how-to/disable-dragging-runtime
2. Provide a “clear groups” button in the grouping bar and upon clicking that button, clear all groups. (Please note that the “clear groups“ button to be shown, only when at least one group is enabled.
3. Show the Grouping grey bar if you group by at least one column and hide the grey bar, if there are no columns to group by. Please confirm if the logic implemented in the attached file to hide and show the grouping grey bar is the correct approach.
Thanks,
Thanks to Petyo for the great tip of using inverted ignore selector for draggable handle!
Please see https://plnkr.co/edit/RLfJEhDDB9k1heXwWb5X?p=preview
<
div
id
=
"draggable"
style
=
"background-color: lightgrey; height: 60px"
>
Drag the buttons to the yellow section<
br
/>
<
button
>Button 1</
button
>
<
button
>Button 2</
button
>
<
button
>Button 3</
button
>
</
div
>
<
div
id
=
"dropTarget"
style
=
"background-color: yellow; height: 60px"
>
</
div
>
var
draggable = $(
"#draggable"
).kendoDraggable({
filter:
'button'
,
hint:
function
(item) {
return
$(item).clone();
}
});
var
dropTarget = $(
"#dropTarget"
).kendoDropTarget({
dragAndDrop:
true
,
drop: droptargetOnDrop
}).kendoDraggable({
filter:
'button'
,
hint:
function
(item) {
return
$(item);
}
});
function
droptargetOnDrop(e) {
// console.log("drop called");
var
$target = $(e.target);
$(e.draggable.hint).clone().appendTo(e.dropTarget)
}