Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style="cursor: move;" not being removed, and exception in processMoutseup #52

Open
bochulindra opened this issue Jan 20, 2015 · 3 comments

Comments

@bochulindra
Copy link

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;
@bochulindra
Copy link
Author

Actually, I looked at the latest version and the "Uncaught TypeError: Cannot read property 'tableDnDConfig' of null" exception is already fixed.

@isocra
Copy link
Owner

isocra commented Jan 21, 2015

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

@bochulindra
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants