TableDnD
TableDnD copied to clipboard
style="cursor: move;" not being removed, and exception in processMoutseup
makeDraggable adds "cursor: move;" if nodrag is not present, but it doesn't remove it if nodrag is present. My use case: I use javascript to add and remove nodrag as needed, then I call tableDnDUpdate(). I expected tableDnDUpdate() to remove the style but it didn't.
This is how I fixed it (I added the else):
// Iterate through each row, the row is bound to "this"
if (!$(this).hasClass("nodrag")) {
$(this).bind(startEvent, function(e) {
if (e.target.tagName == "TD") {
$.tableDnD.initialiseDrag(this, table, this, e, config);
return false;
}
}).css("cursor", "move"); // Store the tableDnD object
} else {
$(this).css("cursor", "");
}
processMouseup throws an exception (Uncaught TypeError: Cannot read property 'tableDnDConfig' of null) if I try to drag an element off the table. This was also an easy fix:
processMouseup: function() {
var droppedRow = this.dragObject,
parentLevel = 0,
myLevel = 0;
if (!this.currentTable || !droppedRow)
return null;
var config = this.currentTable.tableDnDConfig;
Actually, I looked at the latest version and the "Uncaught TypeError: Cannot read property 'tableDnDConfig' of null" exception is already fixed.
Hi @bochulindra,
Thanks for the fix (yes you're right, I fixed the null exception a couple of weeks ago).
I've put your suggested fix into a new branch, and you can access the file here: https://raw.githubusercontent.com/isocra/TableDnD/feature/issue-52-remove-cursor-move/js/jquery.tablednd.js. Could you test it to check it works as you expect? Or better still, send me a little HTML file that simulates the problem? If I can verify that it's fixed, I'll merge this into the master branch.
Thanks Denis
I can provide html that simulates the problem. However, work is a bit busy right now. I'll get to this when I've got some free time.