js-calendar icon indicating copy to clipboard operation
js-calendar copied to clipboard

Disable dragging

Open richrawlings opened this issue 6 years ago • 2 comments

Can drag & drop be disabled? Thanks

richrawlings avatar Mar 04 '18 14:03 richrawlings

That would be great to have, this is a neat calendar.

hussein-nasser avatar Jan 16 '19 23:01 hussein-nasser

This is nice to have especially for displaying data in Read-only mode. For those who want to disable drag and drop feature and don't mind traversing DOM, you may try listening to the built in dragging hook. There might be a better solution but here is what I did

calendar.on('dragging', (calendar, extra) => {
    extra.monthElem.classList.remove('dragged')
    document.querySelectorAll('table.calendar-table > tr > td ').forEach(el => { 
      el.parentNode.replaceChild(el.cloneNode(true), el)
    })
})

jkga avatar Jun 03 '19 08:06 jkga