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

Remove row and sort problem #1078

Closed
fcofabricio opened this issue Oct 3, 2013 · 3 comments
Closed

Remove row and sort problem #1078

fcofabricio opened this issue Oct 3, 2013 · 3 comments
Labels

Comments

@fcofabricio
Copy link

When I remove a row from an ordered table, the ordering is messed up:

http://jsfiddle.net/BaBZT/1/

  • sort column A and remove de line 2
@amclin
Copy link

amclin commented Oct 3, 2013

I think this is the same underlying bug as #1072

@ghost ghost assigned psmolenski Oct 4, 2013
@psmolenski
Copy link
Contributor

It's very likely that both #1078 and #1072 are caused by the same code flaw, but until I investigate it in more detail, I'll leave those issues opened.

@amclin
Copy link

amclin commented Oct 4, 2013

Until the remove row with sorting can be resolved, I've resorted to disabling remove_row from the context menu if a table has been sorted using the following HOT option:

contextMenu: {
    items: {
        "row_above": {},
        "row_below": {},
        "hsep1": "---------",
        "col_left": {},
        "col_right": {},
        "hsep2": "---------",
        "remove_row" : {
            disabled: function() {
                //Find parent handsontable
                var $container = $(this).parents('.handsontable');

                /**
                 * Disable if table has been sorted because of bugs
                 * see https://github.com/warpech/jquery-handsontable/issues/1072
                 * and https://github.com/warpech/jquery-handsontable/issues/1078
                 **/
                if($container.handsontable('getInstance').sortIndex && $container.handsontable('getInstance').sortIndex.length > 0) {
                    return true;
                }
                return false;
            }
        },
        "remove_col": {},
        "hsep3": "---------",
        "undo": {},
        "redo": {}
    }
}

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

No branches or pull requests

3 participants